Hi,
It is not clear whether you read the file correctly or not.? Please check
str(tbl_all)
The code you showed should work if the file was read correctly.
For example:
set.seed(468)
tbl_all<-
as.data.frame(matrix(sample(1:10,10*22,replace=TRUE),ncol=22,dimnames=list(NULL,c("A","V",LETTERS[3:22]))))
str(tbl_all)
#'data.frame':??? 10 obs. of? 22 variables:
# $ A: int? 8 5 7 4 2 4 7 4 3 5
# $ V: int? 4 1 9 1 4 5 3 9 8 3
# $ C: int? 1 5 9 6 1 5 1 8 2 2
# $ D: int? 3 2 1 4 8 2 5 6 2 8
# $ E: int? 5 10 7 7 6 7 10 2 10 7
--------------------------------------
---------------------------------
vec_seq1<-tbl_all[,2]
?is.vector(vec_seq1)
#[1] TRUE
#or
vec_seq2<-tbl_all[,"V"]
?is.vector(vec_seq2)
#[1] TRUE
?identical(vec_seq1,vec_seq2)
#[1] TRUE
A.K.
I want to make a vector of my column "V" in the csv (it's a 22
column in number) so I put this come:
vec_seq <- tbl_all[,2]
I thought that's so easy and it doesnt work. R says "Error in
`[.data.frame`(tbl_all, , 22) : undefined columns selected"