similar to: dataframe, transform, strsplit

Displaying 20 results from an estimated 20000 matches similar to: "dataframe, transform, strsplit"

2012 Jan 25
4
help to slip a file name using "strsplit" function
Dear Researchers, I have several files as this example: Myfile_MyArea1_sample1.txt i wish to split in "Myfile", "MyArea1", "sample1", and "txt", becasue i need to use "sample1" label. I try to use "strsplit" but I am able just to split as "Myfile_MyArea1_sample1" and "txt" OR "Myfile", "MyArea1",
2011 Oct 12
5
strsplit question
Dear R People: I have the following set of data > Block[1:5] [1] "5600-5699" "6100-6199" "9700-9799" "9400-9499" "8300-8399" and I want to split at the - > strsplit(Block[1:5],"-") [[1]] [1] "5600" "5699" [[2]] [1] "6100" "6199" [[3]] [1] "9700" "9799" [[4]] [1]
2012 Dec 11
5
Retain last grouping after a strsplit()
All - I have a column of SiteNames: SiteName OYS-PIA2-FL-1 OYS-PIA2-LA-1 OYS-PI-LA-BB-1 OYS-PIA2-LA-10 ... [truncated] and I want to include only the last few digits into a new column. I tried substr(data$SiteName, 13, 20) but because some SiteName values are of a different length, the final hyphen (i.e., "-") was included: "1" "1" "-1" "10"
2010 Oct 04
3
vectorizing problem
Hello, I have a two column dataframe that has entries that look like this: 2315100 NR_024005,NR_024004,AK093685 2315106 DQ786314 and I want to change this to look like this: 2315100 NR_024005 2315100 NR_024004 2315100 AK093685 2315106 DQ786314 I can do this with the following "for" loop but the dataframe (GPL) has ~140,000 rows and this takes
2005 Dec 22
1
strsplit with dataframes
Hello fellow R people, I can not figure out a pretty way to use strplit with vectors Imagine that I got the following data from someone with ID's representing several factors ID data A1-B1-t1 0 A1-B1-t2 1 A1-B2-t1 5 A1-B2-t2 10 A1-B10-t1 0 A1-B10-t2 1 A1-B20-t1 5 A1-B20-t2 10 ... I would like to turn this dataframe to station substation time data A1 B1 t1 0 A1 B1 t2 1 A1 B2 t1 5
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),"\\.") >
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
2011 Oct 24
2
splitting a string into words preserving blanks (using regex)
I would like to split a string into words at its blanks but also to preserve all blanks. Example: c(" some words to split ") should become c(" ", "some", " ", " words", " ", "to" , " ", "split", " ") I was not able to achieve this via strsplit() . But I am not familiar with regular
2012 Mar 27
1
matrix(unlist(strsplit(""))) 'missing value' issue
*I'm still a R noob, just had a couple of lectures about it in our research master. There is a Deal or no deal experiment where I have to write some code for. Someone wrote a website to gather the data and write it in a .xlsx file. These are seperate files for seperate participants so first I have to import the seperate datafiles. I do that like this: # Merge the xlsx files into one dataframe
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
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 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))
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" " "
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
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 Jun 04
1
Partial Matching
Let's say that I have a string and I want to know if a single word is present in the string. I've written the following function to see if the word "Geico" is mentioned in the string "Cheap Geico car insurance". However, it doesn't work, and I assume it has something to do with the any() function. Do I need to use regular expressions? (I hope not) main <-
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