its maybe not as simple as Teds solution but points to a more general
approach
reshape(mydata,direction="long",varying=names(mydata),v.names=c("id","x","y"))
Am 16.07.2010 13:27, schrieb Ralf B:
> I have the following data structure:
>
> n=5
> mydata <- data.frame(id=1:n, x=rnorm(n), y=rnorm(n),
On 16-Jul-10 11:27:18, Ralf B wrote:
> I have the following data structure:
>
> n=5
> mydata <- data.frame(id=1:n, x=rnorm(n), y=rnorm(n), id=1:n,
> x=rnorm(n), y=rnorm(n))
> print(mydata)
>
> producing the following represention
>
> id x y id.1 x.1y.1
> 1 1 0.
I have the following data structure:
n=5
mydata <- data.frame(id=1:n, x=rnorm(n), y=rnorm(n), id=1:n,
x=rnorm(n), y=rnorm(n))
print(mydata)
producing the following represention
id x y id.1 x.1y.1
1 1 0.5326855 -2.076337031 0.7930274 -1.0530558
2 2 0.78889
3 matches
Mail list logo