Hi Jonathan,thanks a lot! Mine is windows operating system so I will
try other ways .
About your question, do you want to get a matrix like this:
0 1 2 3 ...1817393 5524385
0687
0 64
0 71
0 55
...
Thank you guys I learnt a lot .
But when I tried to run the library(ecodist) function, R says there is no
package called "ecodist".
why?
__
View message @
http://r.789695.n4.nabble.com/from-table-to-matrix-tp3087972p3088184.html
I actually got it to work now using levelplot, and I also worked out how to
get the graph I wanted to display, I had to assign the graph to a reference
and then print it -- yes, that simple!
Now I just need to work out why my levelplot doesn't look quite right, even
though the data is in there...
Maybe I can help here:
In OS X at least you can open the R Package Installer from the Packages &
Data menu, select a mirror, etc, then type ecodist into the search bar and
then Install Selected... this will install the ecodist package on your
machine.
Not exactly sure how it would be done under
OK well I don't mean to "hijack" Jessica's thread with a tangent on graphics
and plots, but I'm still having some trouble. I'm a total newbie here so if
the correct etiquette would be for me to start a new thread at this point
then please do advise me!!
The code I'm now trying to run is:
library
For contour plots, some of the contour functions in graphics packages
(lattice for one IIRC) are pretty good at understanding that columns in
a matrix correspond to x,y, and z values already.
There are many ways to do this in R. For very simple problems, this one
is convenient:
Jonathan -
Same problem, same solution:
Suppose your data frame is called df:
thematrix = matrix(NA,max(df$x),max(df$y))
thematrix[as.matrix(df[,1:2])] = df[,3]
- Phil Spector
Statistical Computing Facility
There are many ways to do this in R. For very simple problems, this
one is convenient:
library(ecodist)
newdata <- crosstab(mydata$x, mydata$y, mydata$z)
For more complicated problems, reshape is very powerful.
Sarah
On Tue, Dec 14, 2010 at 5:13 PM, jonathan wrote:
>
> That's so weird, I just
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of jonathan
> Sent: Tuesday, December 14, 2010 3:14 PM
> To: r-help@r-project.org
> Subject: Re: [R] from table to matrix
>
>
> That's so we
That's so weird, I just signed up on here to ask exactly the same question!
However, I think my issue is like Jessica's who says that her data is like
that, not actually that...
So the issue is not in generating that data on-the-fly but in transforming
it from a data frame to a matrix.
As a mor
Here's one way:
df = data.frame(Date=rep(LETTERS[1:3],each=3),TIME=rep(letters[1:3],3),Q=1:9)
df
Date TIME Q
1Aa 1
2Ab 2
3Ac 3
4Ba 4
5Bb 5
6Bc 6
7Ca 7
8Cb 8
9Cc 9
mat = matrix(0,3,3,dimnames=list(LETTERS[1:3],letters[1:3
11 matches
Mail list logo