[R] how to separate char and num within a variable
Bill Hyman
billhyman1 at yahoo.com
Fri Feb 6 01:47:19 CET 2009
Thank you!
----- Original Message ----
From: "markleeds at verizon.net" <markleeds at verizon.net>
To: Bill Hyman <billhyman1 at yahoo.com>
Sent: Thursday, February 5, 2009 3:35:54 PM
Subject: RE: [R] how to separate char and num within a variable
hi: you can do below but there should possibly be a better way so I'm sending offline in
order to encourage better replies from the guRus. good luck.
temp <- "chr1:000889594-000889638"
temp2 <- strsplit(temp, ":|-")
print(temp2)
"chr1:000889594-000889638",
On Thu, Feb 5, 2009 at 6:20 PM, Bill Hyman wrote:
> Hi all,
>
> I read in a column which looks like "chr1:000889594-000889638", and need to break them into three columns like "chr1:", "000889594" and "000889638". How shall I do in R. Thanks a lot for your suggestions!
>
> Bill
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list