Because it uses regexp: use split='\\.' to split on "." char
and read help(strsplit) :)

Ryszard


--------------------------------------------------------------------------
Confidentiality Notice: This message is private and may contain confidential 
and proprietary information. If you have received this message in error, please 
notify us and remove it from your system and note that you must not copy, 
distribute or take any action in reliance on it. Any unauthorized use or 
disclosure of the contents of this message is not permitted and may be unlawful.
 
-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Czerminski, Ryszard
Sent: Thursday, January 12, 2012 10:16 AM
To: r-help
Subject: [R] strsplit() does not split on "."?

Any ideas what is wrong?

> strsplit("a.b", ".") # generates empty strings with split="."
[[1]]
[1] "" "" ""

> strsplit("a b", " ") # seems to work fine with split=" ", and other
characters...
[[1]]
[1] "a" "b"
>

> R.Version()
$platform
[1] "x86_64-unknown-linux-gnu"
$arch
[1] "x86_64"
$os
[1] "linux-gnu"
$system
[1] "x86_64, linux-gnu"
$status
[1] ""
$major
[1] "2"
$minor
[1] "14.1"
$year
[1] "2011"
$month
[1] "12"
$day
[1] "22"
$`svn rev`
[1] "57956"
$language
[1] "R"
$version.string
[1] "R version 2.14.1 (2011-12-22)"

Best regards,
Ryszard



Ryszard Czerminski
AstraZeneca Pharmaceuticals LP
35 Gatehouse Drive
Waltham, MA 02451
USA
781-839-4304
ryszard.czermin...@astrazeneca.com


------------------------------------------------------------------------
--
Confidentiality Notice: This message is private and may
...{{dropped:11}}

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to