similar to: (PR#8777) strsplit does [not] return correct value when spliting ""

Displaying 20 results from an estimated 7000 matches similar to: "(PR#8777) strsplit does [not] return correct value when spliting """

2006 Apr 17
1
strsplit does not return correct value when spliting "" (PR#8777)
Full_Name: Charles Dupont Version: 2.2.0 OS: linux Submission from: (NULL) (160.129.129.136) when strsplit("", " ") returns character(0) where as strsplit("a", " ") returns "a". these return values are not constiant with each other. Charles Dupont
2008 Jul 17
2
spliting a string
Hi String<-"130.5" Df<-Strsplit(".",":",String) Then Df get "" "" "" "" But I want Df should contains Df "130" "5" If any body knows how to do it.tel me Thanks K.Ravichandra [[alternative HTML version deleted]]
2009 Dec 17
2
Problem with spliting a dataframe values
Hi all, Hi this is kiran I am facing a problem to split a dataframe that is.. i have a string like: "a,b,c|1,2,3|4,5,6|7,8,8" first I have to split with respect to "|" I did it with command unlist(strsplit("a,b,c|1,2,3|4,5,6|7,8,8", "\\,")) after getting that set i made it as a dataframe and it comes like a,b,c 1,2,3 4,5,6 7,8,8 now i have to
2007 Dec 13
6
spliting strings ...
Hi everyone, I have a vector of strings, each string made up by different number of words. I want to get a new vector which has only the first word of each string in the first vector. I came up with this: str <- c('aaa bbb', 'cc', 'd eee aa', 'mmm o n') str1 <- rep(1, length(str)) for (i in 1:length(str)) { str1[i] <- strsplit(str, "
2009 Sep 08
1
Character manipulation using "strsplit" & vectorization
Dear R users, Suppose I have a data set with inconsistent names for a field. I desire to make these to consistent names. i.e "University of New Jersey", "New Jersey Uni", "New Jersey University" (3 different inconsistent names) to "The University of New Jersey" (consistent name) Below are arbitrary data set produced from "state.name" (built
2009 Sep 25
7
Spliting columns, strings or reg exp returning substrings
Currently as the first column in a data frame I have string values in the format xx_yy - I want to create a new column with just the substring xx (for each row in turn). Three possible ways to do this might be (1) split the string by '_' using strsplit and paste the first of the resulting variables into a new column, but I have been unable to do this for each row of my data frame in turn
2005 Oct 28
1
Error in ?strsplit
Hi all, Came across an error in ?strsplit in the details section: Details: Arguments 'x' and 'split' will be coerced to character, so you will see uses with 'split = NULL' to mean 'split = character(0)', including in the examples below. I caught myself trying to use strsplit() on a factor and the coercion on 'x' is not done. According
2009 Aug 10
2
strsplit a matrix
Dear all, I am trying to split a matrix into 2 as efficiently as possible. It is a character matrix: 1 2 3 1 "2-271" "2-367" "1-79" 2 "2-282" "2-378" "1-90" 3 "2-281" "2-377" "1-89" I want to make 2 matrices from this, as succinctly and efficiently as possible. I've tried such
2012 May 30
1
gsub/strsplit with multiple patterns/splits
Hi, I have a vector like this: DF <- c("Aetna, Inc.", "Alexander's Inc.", "Allegheny Energy, Inc") For each element in the vector I would like to remove the "incorporated" info, so that my vector looks like this: DF <- c("Aetna", "Alexander's", "Allegheny Energy") That means that I have to strip: strip <-
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" " "
2010 Nov 01
1
spliting first 10 words in a string
Hi all, I have a columnn with text that has quite a few words in it. I would like to split these words in separate columns, but just first ten words in the string. Is that possible in R? Thank you, m [[alternative HTML version deleted]]
2007 Feb 01
0
Fwd: Re: read.spss and encodings
--- John Kane <jrkrideau at yahoo.ca> wrote: > Date: Thu, 1 Feb 2007 09:07:11 -0500 (EST) > From: John Kane <jrkrideau at yahoo.ca> > Subject: Re: [R] read.spss and encodings > To: Thomas Friedrichsmeier > <thomas.friedrichsmeier at ruhr-uni-bochum.de> > > Hi Thomas, > > I am using R 2.4.1 on WindowsXP and I don't seem to > be > having any
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,
2006 Jul 28
1
spliting
Dear mailing list, I have a big data frame and each element in the matrix has two alphabets. I want to split those alphabets into two so each element will have one alphabet and the number of my columns will be doubled . So can some one help with the code? Example of what I want is to split them. Input (three column) GG AG AG CC CC CC CC CC CC AG
2009 Sep 07
2
using an array of strings with strsplit, issue when including a space in split criteria
Dear all, I'm having a problem understanding why a split does not occur with in the 2nd use of the function strsplit below: # text strings > txt <- c("sales to 23 August 2008 published 29 August", + "sales to 6 September 2008 published?11 September") # first use > strsplit(txt, 'published', fixed=TRUE) [[1]] [1] "sales to 23 August 2008 "
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
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
2017 Jan 06
0
strsplit(perl=TRUE), gregexpr(perl=TRUE) very slow for long strings
While doing some speed testing I noticed that in R-3.2.3 the perl=TRUE variants of strsplit() and gregexpr() took time proportional to the square of the number of pattern matches in their input strings. E.g., the attached test function times gsub, strsplit, and gregexpr, with perl TRUE (PCRE) and FALSE (TRE), when the input string contains 'n' matches to the given pattern. Notice the