[R] data frame
Wolfgang Raffelsberger
wraff at igbmc.fr
Tue Sep 1 11:26:16 CEST 2009
Try doing somthing like this :
#your vector1 & 2
vect1 <- 2:5
vect2 <- c(3,1,6,4)
# put both vectors in data.frame
combVect <- data.frame(vect1=vect1, vect2=vect2)
Note :
1) I suggest to avoid naming objects with names of already existing
functions like "rm"
2) In R it is usually helpful to see your data as vetors and this way
you can avoid for for() loop
3) Have also a look at the R-Wiki (
http://wiki.r-project.org/rwiki/doku.php ) and the other documents on
www.r-project.org : There are some very good tutorials about the
different types of data-structures and objects in R (and their use) !!!
Wolfgang
Tammy Ma a écrit :
> 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)
>
> }
>
> thanks a lot
>
> Tammy
>
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wolfgang Raffelsberger, PhD
Laboratoire de BioInformatique et Génomique Intégratives
CNRS UMR7104, IGBMC,
1 rue Laurent Fries, 67404 Illkirch Strasbourg, France
Tel (+33) 388 65 3300 Fax (+33) 388 65 3276
wolfgang.raffelsberger (a t) igbmc.fr
More information about the R-help
mailing list