similar to: convert delimited string to vector

Displaying 20 results from an estimated 10000 matches similar to: "convert delimited string to vector"

2006 Oct 05
3
mean relative differences from all.equal() (PR#9276)
Full_Name: Brad Christoffersen Version: 2.3.1 OS: Windows XP Submission from: (NULL) (128.196.193.132) Why is the difference between two numbers so different from the "mean relative difference" output from the all.equal() function? Is this an artifact of the way R stores numerics? I could not find this problem as I searched through the submitted bugs. But I am brand new to R so I
2023 Apr 12
3
Split String in regex while Keeping Delimiter
Hello List, ? I have a dataset consisting of strings that I want to split while saving the delimiter. ? Some example data: ?leucocyten + gramnegatieve staven +++ grampositieve staven ++? ?leucocyten ? grampositieve coccen +? ? I want to split the strings such that I get the following result: c(?leucocyten +?, ??gramnegatieve staven +++?, ??grampositieve staven ++?) c(?leucocyten ??, ?grampositieve
2023 Apr 12
2
Split String in regex while Keeping Delimiter
I thought replacing the spaces following instances of +++,++,+,- with "\n" and then reading with scan should succeed. Like Ivan Krylov I was fairly sure that you meant the minus sign to be "-" rather than "?", but perhaps your were using MS Word as an editor which is inconsistent with effective use of R. If so, learn to use a proper programming editor, and in any case
2013 Jul 10
2
Replacing part of delimited string with R's regex
I have the following list of strings: name <- c("hsa-miR-555p","hsa-miR-519b-3p","hsa-let-7a") What I want to do is for each of the above strings replace the text after second delimiter with "zzz". Yielding: hsa-miR-zzz hsa-miR-zzz hsa-let-zzz What's the way to do it? [[alternative HTML version deleted]]
2023 Apr 12
1
Split String in regex while Keeping Delimiter
On Wed, 12 Apr 2023 08:29:50 +0000 Emily Bakker <emilybakker at outlook.com> wrote: > Some example data: > ?leucocyten + gramnegatieve staven +++ grampositieve staven ++? > ?leucocyten ? grampositieve coccen +? > ? > I want to split the strings such that I get the following result: > c(?leucocyten +?, ??gramnegatieve staven +++?, > ??grampositieve staven ++?) >
2011 Oct 03
2
Parsing variable-length delimited strings into a matrix
I'm struggling to find a way of parsing a vector of data in this sort of form: A,B,C B,B A,AA,C A,B,BB,BBB,B,B into a matrix (or data frame). The catch is that I don't know a priori how many entries there will be in each element, nor how many characters there will be. strsplit(vec,",") gets me a list, but I can't find a way of turning the list into a matrix. unlistlst)
2003 Oct 13
1
extracting quoted text from character string
Hello all, I am trying to solve a problem, and my solution is rather ugly and not very general. The posts for "[R] help with gsub and grep functions" seemed relevent and gave me hope for a more refined and more general solution. The Problem: line <- "'this text has spaces' 'thisNot' 3 4 5 6 7 8 9 10" bad.line <- "'this text has spaces'
2023 Apr 13
1
Split String in regex while Keeping Delimiter
Dear Emily, Using a look-behind solves the split problem in this case. (Note: Using Regex is in most/many cases the simplest solution.) str = c("leucocyten + gramnegatieve staven +++ grampositieve staven ++", "leucocyten ? grampositieve coccen +") tokens = strsplit(str, "(?<=[-+])\\s++", perl=TRUE) PROBLEM The current expression does NOT work for a different
2007 Jul 17
1
data.restore() in R 2.5.1 for Windows 95 and later
To Whom It May Concern: I want to read in an S-PLUS data dump and I used > data.restore("filepath/filename") (in R 2.5.1 for Windows 95 and later) and I get the message Error: could not find function "data.restore" I have also tried read.S() and read.dta() with the same result. I cannot find any of these functions in the R Help for package base, although data.restore()
2007 Sep 10
1
overlay lattice histograms with goodness-of-fit pdfs
Hello, I am new to R exploratory data analysis and plotting. Is anyone aware of a way to overlay a set of conditional histograms with conditional PDFs? Below, I generate a lattice plot of precipitation histograms based on different months and stations, given a subset of the dataset: histogram(~ data | month * station, data = sta.stack[sta.stack[,"type"]=="precip" &
2005 Aug 11
2
Converting strings with internal delimiters into lists
Hi UserRs, I know that there has to be an easy way to do this in R (probably easy enough that once someone clues me in I'll smack myself on the forehead for not figuring it out myself), but my searches on my own have not yielded any hints. I have many fields in my dataset that participants entered as "free lists" - i.e., the field constitutes a varying number of names each
2010 Nov 22
3
"unexpected numeric constant" while reading tab delimited csv file
my csv file is very simple - just one line for purpose of this test: 0{TAB}0 and read function is this: csvdata = read.csv(file="d:/s/test.csv",head=FALSE,sep="\t") then error comes: Error in source("d:/test.csv") : d:/test.csv:1:9: unexpected numeric constant 1: 0 0 but when I change delimiter to ; (colon) then error not shows up anymore -- View this
2010 Apr 23
2
Problem with parsing a dataset - help earnestly sought
Dear fellow R-help members, I hope to seek your advice on how to parse/manage a dataset with hundreds of columns. Two examples of these columns, 'cancer.problems', and 'neuro.problems' are depicted below. Essentially, I need to parse this into a useful dataset, and unfortunately, I am not familiar with perl or any such language. data <- data.frame(id=c(1:10))
2007 Sep 25
5
extracting data using strings as delimiters
Dear List, I have an ascii text file with data I'd like to extract. Example: Year Built: 1873 Gross Building Area: 578 sq ft Total Rooms: 6 Living Area: 578 sq ft There is a lot of data I'd like to ignore in each record, so I'm hoping there is a way to use strings as delimiters to get the data I want (e.g. tell R to take data between "Built:" and "Gross" -
2012 Nov 29
4
splitting a string by space except when contained within quotes
I've been trying to split a space delimited string with double-quotes in R for some time but without success. An example of a string is as follows: /rainfall snowfall "Channel storage" "Rivulet storage"/ It's important for us because these are column headings that must match the subsequent data. Here is some code I've been trying: str <- 'rainfall
2011 Nov 18
1
Reading a file w/ two delimiters
Hi all, I've been scratching and poking, but basically, the file I need to read has two delimiters that I need to contend with. The first is that the file contains tabs (\t) , instead of newlines (\n), and the second is that the fields have | for the seperators. I can easily do a read if I first convert the \t to \n and then use read.table to get the file read with the | separator. But, what
2007 May 03
2
Parsing data with an uneven number of delimiters
I have a list of data that is delimited by a / and, as long as there is an equal number of delimiters, I can parse the data and put it into a data frame: > t1<-c("a/a/a","b/bb/bbb","ccc/cc/c") > t2<-strsplit(t1,"/") > t3<-data.frame(t2) > t3 c..a....a....a.. c..b....bb....bbb.. c..ccc....cc....c.. 1 a
2020 Feb 21
1
Support for Dashes in the Raw String Delimiter
Dear R Developers, As regards "Support for Dashes in the Raw String Delimiter" from commit: https://github.com/wch/r-source/commit/4d4781ad19890193d5eb458d71f18d7e53ee73c5 Would it be possible to support in addition to r"" Syntax, for not escaping backlash character in strings, also support """ """ (Python Like Syntax), for also allowing to have
2010 Jun 15
2
Fastest way to merge matrix columns into a comma delimited string?
Folks: Say I have a matrix: test=matrix(c(1,2,3),nrow=10,ncol=3) I would like to have an output character vector where each line is row's values delimited by commas, e.g.: "1,2,3" "2,3,1" "3,1,2" ... "1,2,3" What is the fastest way of doing this? I can paste() row-by-row but this seems an inefficient approach to doing this. Thanks! I'm not
2002 Mar 29
3
Newbie struggling with "factors"
I am processing some survey results, and my data are being read in as "factors". I don't know how to process these things in any way. To start with, several of the survey questions are mulit-choice check boxes on the original (web-based) survey, as in "check all that apply". These are encoded as numbers. For example, if the survey has a question: Which operating systems