I have one vector created using the following code:
vectorA<-c(1.125,2.250,3.501) I have another vector stored in a data frame:
vectordf<-data.frame() vectordf[1,1]<-'1.125,2.250,3.501' vectorB<-vectordf[1,1] I need vectorB to be the same as vectorA so I can use it in another function. Right now the two vectors are different as shown below:
printerA<-paste("vectorA=",vectorA) printerB<-paste("vectorB=",vectorB) print(printerA) print(printerB) dput(vectorA) dput(vectorB) [1] "vectorA= 1.125" "vectorA= 2.25" "vectorA= 3.501" [1] "vectorB= 1.125 2.250 3.501" c(1.125, 2.25, 3.501) "1.125 2.250 3.501" How can I get vectorB into the same format as vectorA? I have tried using as.numeric, as.list, as.array, as.matrix.
vectorB <- scan(text = '1.125,2.250,3.501', sep = ",")?