'Sarah Goslee'
Cc: 'r-help'
Sent: Monday, November 26, 2012 2:33 PM
Subject: Re: [R] Help in splitting the records
Another approach is to use gsub() followed by read.table():
> x <- c("qwer$$12$$qwre", "ewrtr$7789$ewwe")
> x <- gsub("\\$+&
.org] On Behalf Of Bert Gunter
> Sent: Monday, November 26, 2012 1:00 PM
> To: Sarah Goslee
> Cc: r-help
> Subject: Re: [R] Help in splitting the records
>
> Sarah:
>
> You may not agree, but the following avoids the IMHO ugly rbind() and
> separate conversion to numeric
Sarah:
You may not agree, but the following avoids the IMHO ugly rbind() and
separate conversion to numeric by using scan():
## first, as before..
x <- c("qwer$$12$$qwre", "ewrtr$7789$ewwe")
x <- strsplit(x, "\\$+")
## Then, instead ...
x.convert <- data.frame(scan(textConnection(unlist(x)),wh
it appears that two separators are to be
treated as one?
From: arunkumar
To: r-help@r-project.org
Sent: Monday, November 26, 2012 5:51 AM
Subject: [R] Help in splitting the records
Hi
I have set of records seperated by a separator say "$$$" i want to
- Original Message -
From: arunkumar
To: r-help@r-project.org
Cc:
Sent: Monday, November 26, 2012 5:51 AM
Subject: [R] Help in splitting the records
Hi
I have set of records seperated by a separator say "$$$" i want to get the
values in a dataframe.
eq
qwer$$12$$q
You state that you want "$$$" as the separator, but your example has
"$$" and "$" so I'm assuming an indeterminate number of consecutive
$.
x <- c("qwer$$12$$qwre", "ewrtr$7789$ewwe")
x <- strsplit(x, "\\$+")
x <- do.call(rbind, x)
x <- data.frame(x, stringsAsFactors = FALSE)
x$X2 <- as.numeric(x
Hi
I have set of records seperated by a separator say "$$$" i want to get the
values in a dataframe.
eq
qwer$$12$$qwre
ewrtr$7789$ewwe
I want the output as\
V1 V2V3
qwer 12 qwre
ewrtr 7789 ewwwe
Please help me
-
Thanks in Advance
Arun
--
View this message in con
7 matches
Mail list logo