shank
Cc: r-help@r-project.org
Subject: Re: [R] Question on sapply
Try this:
lapply(z, as.numeric)
On Wed, Feb 9, 2011 at 5:16 PM, Khanvilkar, Shashank
mailto:skhan...@qualcomm.com>> wrote:
Hello All,
Thanks in advance for all help
I have the following vector of strings that I want to split
Sorry.. my bad.. I should have done
z = lapply(z, as.numeric)
That works.
Shank
From: Khanvilkar, Shashank
Sent: Wednesday, February 09, 2011 1:33 PM
Cc: r-help@r-project.org
Subject: RE: [R] Question on sapply
Thanks,
Nopes.. Does not seem to work.
> lapply(z, as.numeric)
[[1]]
[1] 1 1
Try this:
lapply(z, as.numeric)
On Wed, Feb 9, 2011 at 5:16 PM, Khanvilkar, Shashank
wrote:
> Hello All,
> Thanks in advance for all help
> I have the following vector of strings that I want to split..
>
> > y = c("1/1","2/2", "3/3", "4/4")
> > y
> [1] "1/1" "2/2" "3/3" "4/4"
> > z = strsplit(y,
Hello All,
Thanks in advance for all help
I have the following vector of strings that I want to split..
> y = c("1/1","2/2", "3/3", "4/4")
> y
[1] "1/1" "2/2" "3/3" "4/4"
> z = strsplit(y,"/")
> z
[[1]]
[1] "1" "1"
[[2]]
[1] "2" "2"
[[3]]
[1] "3" "3"
[[4]]
[1] "4" "4"
Now how do I convert all
4 matches
Mail list logo