similar to: Error in ?strsplit

Displaying 20 results from an estimated 10000 matches similar to: "Error in ?strsplit"

2019 Dec 18
2
A weird behaviour of strsplit?
Hi all, In the help of strsplit one can read split character vector (or object which can be coerced to such) containing regular expression<http://127.0.0.1:39783/help/library/base/help/regular%20expression>(s) (unless fixed = TRUE) to use for splitting. If empty matches occur, in particular if split has length 0, x is split into single characters. Ifsplit has length greater than 1, it is
2010 Jul 08
2
strsplit("dia ma", "\\b") splits characterwise
\b is word boundary. But, unexpectedly, strsplit("dia ma", "\\b") splits character by character. > strsplit("dia ma", "\\b") [[1]] [1] "d" "i" "a" " " "m" "a" > strsplit("dia ma", "\\b", perl=TRUE) [[1]] [1] "d" "i" "a" " "
2007 Oct 22
3
strsplit
Hello R Gurus: I would like to take a character string and split at the $ sign. I thought that strsplit would do it, but here are the results: > vv [1] "whine$ts1" > vv [1] "whine$ts1" > strsplit(vv,"$") [[1]] [1] "whine$ts1" Does anyone have any suggestions, please? Thanks, Edna Bell
2009 Oct 05
1
Characters vs. factors
It seems like a recent trend in R has been to make character vectors and factors almost equivalent (apart from the way that factors always remember their original range). There are a few exceptions: * summary.character != summary.factor * table(x, exclude = NULL) != table(factor(x), exclude=NULL) when x includes missing values * strsplit on a factor > strsplit(factor(c("a",
2006 Jun 05
2
grep() and factors
Hi all, Based upon an offlist communication this morning, I am somewhat confused (more than I usually am on most Monday mornings...) about the use of grep() with factors as the 'x' argument. The argument guidance in ?grep indicates: x, text a character vector where matches are sought. Coerced to character if possible. and in the Details section: Arguments which should be
2008 Jun 12
2
numbers as part of long character
Hi, I'm looking for some way to pick up the numbers which are contained and buried in a long character. For example, outtree.new="(((B:1204.25,E:1204.25):7581.11,F:8785.36):8353.85,C:17139.21);" num.char =
2006 Aug 19
4
string-to-number
Greetings, Amigos: I have been trying without success to convert a character string, > repeated.measures.columns [1] "3,6,10" into c(3,6,10) for subsequent use. as.numeric(repeated.measures.columns) doesn't work (likely because of the commas) [1] NA Warning message: NAs introduced by coercion I've tried many things including strsplit(repeated.measures.columns, split =
2019 Dec 18
0
A weird behaviour of strsplit?
On 18/12/2019 9:42 a.m., IAGO GIN? V?ZQUEZ wrote: > Hi all, > > In the help of strsplit one can read > > split character vector (or object which can be coerced to such) containing regular expression<http://127.0.0.1:39783/help/library/base/help/regular%20expression>(s) (unless fixed = TRUE) to use for splitting. If empty matches occur, in particular if split has length 0,
2012 Apr 11
1
strsplit help
Dear all, I want to use string split to parse column names, however, I am having some errors that I don't understand. I see a problem when I try to rbind the output from strsplit. please let me know if I'm missing something obvious, thanks, alison here are my commands: >strsplit<-strsplit(as.character(Rumino_Reps_agreeWalign$geneid),"\\.") >
2006 Apr 04
1
extending strsplit(): supply pattern to keep, not to split by
strsplit() is a convenient way to get a list of items from a string when you have a regular expression for what is not an item. E.g., > strsplit("1.2, 34, 1.7e-2", split="[ ,] *") [[1]]: [1] "1.2" "34" "1.7e-2" However, sometimes is it more convenient to give a pattern for the items you do want. E.g., suppose you want to pull
2006 May 19
5
Converting character strings to numeric
I assume that I have missed something fundamental and that it is there in front of me in "An Introduction to R", but I need someone to point me in the right direction. > x1 <- "1159 1129 1124 -5 -0.44 -1.52" > x2 <- c("1159","1129","1124","-5","-0.44","-1.52") > x3 <- unlist(strsplit(x1,"
2009 Sep 17
2
Why strsplit can be used with matrix but not data.frame?
Hi, As show in the code below, strsplit can be applied to a matrix but not a data.frame. I don't understand why R is designed in this way. Can somebody help me understand it? How to split all the strings in x$y? x=data.frame(x=1:10,y=rep("abc",10)) strsplit(x$y,'b') #Error in strsplit(x$y, "b") : non-character argument y=cbind(1:10,rep("abc",10))
2012 Feb 11
2
obtaining a true/false vector with combination of strsplit, length, unlist,
Hi, A pared down version of the dataset I'm working with: edm<-read.table(textConnection("WELLID X_GRID Y_GRID LAYER ROW COLUMN SPECIES CALCULATED OBSERVED w301_3 4428. 1389 2 6 18 1 3558 6490. w304_12 4836. 6627 2 27 20 1 3509 3228. 02_10_12080 3.6125E+04 13875 1 56 145 1
2012 Aug 24
1
POSIXct-coerced NA's not considered NA by is.na()
Hello folks, I found a strangeness while experimenting with POSIXct vectors and lists. It seems that coerced NA's aren't "real" NAs, at least as considered by is.na()? > date_vec = c(as.POSIXct(now()), as.POSIXct(now()+1),NA,"b") > date_vec [1] "2012-08-22 15:00:46 COT" "2012-08-22 15:00:47 COT" NA [4] NA Warning message: In
2011 Feb 04
3
lapply, strsplit, and list elements
Hi there, I have a problem about lapply, strsplit, and accessing list elements, which I don't understand or cannot solve: I have e.g. a character vector with three elements: x = c("349/077,349/074,349/100,349/117", "340/384.2,340/513,367/139,455/128,D13/168", "600/437,128/903,128/904") The task I want to perform, is to generate a list,
2012 Mar 22
2
Strsplit with a separator of ||
Hi, I tried to use strsplit for separating a string with || like strsplit(string,"\\||") but it returned each single character was separated. For example: strsplit("a||bc","\\||") [[1]] [1] "a" "" "" "b" "c" where I want the result to be "a" and "bc". Any ideas? Thanks! Best,
2006 Aug 29
3
Substring and strsplit
Dear R People: I am trying to split a character vector into a set of individual letters: Ideal: x3 <- c("dog") "d" "o" "g" I tried the following: > strsplit(x3) Error in strsplit(x3) : argument "split" is missing, with no default > strsplit(x3,1) [[1]] [1] "dog" I know that this is incredibly simple, but what am I doing
2011 Aug 03
2
strsplit and forward slash '/'
Hi All, is there a way of using strsplit with a forward slash '/' as the splitting point? For data such as: 1 T/T C/C 16/33 2 T/T C/C 33/36 3 T/T C/C 16/34 4 T/T C/C 16/31 5 C/C C/C 28/29 6 T/T C/C 16/34 strsplit(my.data[1,1], "/") # and any variation thereof Error in strsplit(apoe[1, 1], "/") : non-character
2012 Nov 08
3
strsplit with invalid regular expression
Hi all, > diff_operator <- "\\(" > strsplit(cond, diff_operator) [[1]] [1] "andsin" "log_angle_1_4)" > diff_operator <- "\\sin(" > strsplit(cond, diff_operator) Error in strsplit(cond, diff_operator) : invalid regular expression '\sin(', reason 'Missing ')'' When I am going to split with "("
2007 Dec 03
3
strsplit on comma, with a trailing comma in input
I have a comma-separated data file in which trailing commas sometimes occur. I am using strsplit to extract the data from this file, and it seems great except in cases with trailing comma characters. The example below illustrates. What I'd like is to get a fourth element in the answer, being an empty string just like the second element. Is there a way I can express my patter (or perhaps