I have the following string input:
input <-
"ACC,1.1,2.2,3.3,4.4\nACC,2.2,3,4,5\nADN,3.3,4,5\nACC,4.4,5.5,6.6,7.7\nADN,5.5,6,7\n"
Note that \n is a real line feed in the data and the numbers are all made up
and might be other values. The key is that the first number is a float, the
ACC packets ar
Hi
If I use your code:
grep ("ACC", input, FALSE, FALSE, TRUE)
#[1]
"ACC,1.1,2.2,3.3,4.4\nACC,2.2,3,4,5\nADN,3.3,4,5\nACC,4.4,5.5,6.6,7.7\nADN,5.5,6,7\n"
Seems like you forgot one line of code: with ?strsplit()
vec1<- grep("ACC",strsplit(input,"\n")[[1]],FALSE,FALSE,TRUE)
vec1
#[1] "ACC,1.1,2.2,
Thank you. I was doing a strsplit and forgot to include it in my post. What
was confusing me is that the result doesn't look like a vector. I guess it
actually is. I will try writing it out and see if I get what I want from it.
Thanks!
--
View this message in context:
http://r.789695.n4.nabble
3 matches
Mail list logo