On 21/02/2009, at 12:54 AM, lauramorg...@bluewin.ch wrote:
Thank you for your advice, but I didn't manage to make it work...
I tried
carichi.annui <- data.frame
(anno,loadPTG,loadPO4,loadNT,loadNH4,loadNO3,loadBOD5,loadSiO2)
And I got this error message:
Error in data.frame(anno, loadPTG, loadPO4, loadNT, loadNH4,
loadNO3, :
the arguments have a different numer of rows: 4, 1
If I do
sapply(carichi.annui, class)
I get:
anno loadPTG loadPO4 loadNT loadNH4 loadNO3 loadBOD5
loadSiO2
"list" "list" "list" "list" "list" "list" "list"
"list"
I thought that the function as.vector() could turn a list of
numbers into a vector... was I wrong?
Yes, you were wrong. E.g.:
> u <- list(1,2,3)
> v <- as.vector(u)
> class(v)
[1] "list"
> all.equal(u,v)
[1] TRUE
Despite what some people (whose arrogance exceeds their wisdom) will
try to tell you,
vectors can be considered to be lists. At a certain level.
If you want to turn an object of class "list" into a ``real'' vector
(e.g. of class
"numeric") use unlist():
> w <- unlist(v)
> class(w)
[1] "numeric"
> all.equal(w,1:3)
[1] TRUE
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
______________________________________________
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.