I am having a problem with creating a vector from a rows or columns, I
searched around and found as.vector(x), but it does not seem to do what it
says it does

 

I have included an example below, of doing what would seem to be the method
required to create a vector, but instead it creates a one row data frame.
What is required to actually create a vector.

 

Many thanks

Philip

 

> data

  V1   V2   V3   V4   V5   V6    V7    V8    V9   V10   V11

1  E 2369 2304 2312 2460 2645  3038  3265  3760  3904  4421

2 NZ  705  817  907  917  954 1,026 1,065 1,125 1,276 1,449

 

> nz <-as.vector(data[2,2:11])

 

> nz

   V2  V3  V4  V5  V6    V7    V8    V9   V10   V11

2 705 817 907 917 954 1,026 1,065 1,125 1,276 1,449

 

> class(nz)

 

[1] "data.frame"


        [[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.

Reply via email to