[R] Odp: data frame

Petr PIKAL petr.pikal at precheza.cz
Tue Sep 1 11:44:36 CEST 2009


Hi

r-help-bounces at r-project.org napsal dne 01.09.2009 10:39:42:

> 
> HI, R user,
> 
> I generate the vectors with the same length. I want to put each vector 
into 
> each column of data frame. Why it doesnt work`?
> 
> rm<-data.frame()
> 
> for(a in 1:6){
>  rm[,a]<-getmeasure(p1,a,speech)
> 
>  }

Well, couldn't it be because function getmeasure does not exist?

Error: could not find function "getmeasure"

and you get another error

rm[,a]
Error in `[.data.frame`(rm, , 1:2) : undefined columns selected

If you need to put a vector to data frame you shall preassign the 
structure, columns and rows.

Or you can use list and as.data.frame

Regards
Petr

> 
> thanks a lot
> 
> Tammy
> 
> 
> _________________________________________________________________
> Share your memories online with anyone you want.
> 
http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1

>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list