I have never used it, but I think the reshape and/or reshape2 packages
are designed for it.
Check the melt() and cast() functions in these packages... I guess...
Ivan
Le 3/4/2011 11:33, Dmitrij Kudriavcev a écrit :
Hello, no. I need to change data format, so i can build covariance matrix on
it
Cheers,
Dima
2011/3/4 Alberto Negron<albertoneg...@gmail.com>
Can't you just convert you df as follow matrix<- as.matrix(s) ?
Double check it as I am a newbie too. :-)
Regards,
Alberto
On 4 March 2011 06:08, Dmitrij Kudriavcev<dimitrij.kudriav...@ntsg.lt>wrote:
Hello
I'm a new in R
I have a large data.frame "s" (this is actualy just a table in mysql) :
names(s)
[1] "symbols", "day", "value"
I need to convert it to simple matrix. I have define this matrix like
this:
data.matrix<- matrix(nrow=nDays, ncol=nSymbols, dimnames=list(days,
symbols))
then i just copy values to the matrix using for() loop, but it seems to
take
very long time. Is is a more fast way to do it in R? I know, what i can
just
gyve s$value as source data to the matrix, but problem is, what for some
symbols couple days could be just missed.
Cheers,
Dima
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de
**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.