similar to: strsplit and regex

Displaying 20 results from an estimated 8000 matches similar to: "strsplit and regex"

2010 Aug 28
9
How to define new matrix based on an elementary row operation in a single step?
-- View this message in context: http://r.789695.n4.nabble.com/How-to-define-new-matrix-based-on-an-elementary-row-operation-in-a-single-step-tp2341768p2341768.html Sent from the R help mailing list archive at Nabble.com.
1997 Aug 04
3
R-alpha: .Options$digits do not (always) work.
I am sorry that this IS an old topic. Yet another task I think the bug is somewhere in hidden in src/main/options.c .. ##-- The following does not work as it should in R (0.50-a1, but I think also earlier) tst <- function(x=pi, dig =3) {.Options$digits <- as.integer(dig); print(x);x} tst() tst(dig = 12) ##-- This should do the same; it works as expected in R & S : tst2
2009 Aug 03
3
Help with reshaping data.frame
I'm having trouble reshaping a data.frame from long to wide. (I think that's the right terminology; feel free to educate me.) I've looked at the reshape function and package and plyr package, but I can't quite figure out how to do this after a dozen variations. I have a data.frame with more levels than this, but similar to: > tst K1 K2 K3 V1 V2 V3 1 10 D a 0.08 99
2010 Oct 07
2
Testing for existence of object within a function
I'm trying to test for the existence of an object within a function, but despite searching the help files and R-list, I can't figure out how to do it. Here is some test code: #------------------------- a=1 #now I have a in the global environment tst <- function(a,b=1) { # but a is not in the local function environment print(exists("a", inherits=FALSE)) #This is how I think
1997 Aug 05
3
R-alpha: Version 0.50-a1 patches
A set of patches for R-0.50-a1 is now available as ftp://stat.auckland.ac.nz/pub/R/R-0.50-a1.patch1.gz The patches mainly fix problems reported since R-0.50-a1 but some older problems are also fixed. Here is the list of changes. Ross o Many subsetting and mutation problems with the new "expression" type have now been fixed. o When ask=T is set in par() the user is instructed
2005 Jul 02
2
Is it possible to use glm() with 30 observations?
I have a very simple problem. When using glm to fit binary logistic regression model, sometimes I receive the following warning: Warning messages: 1: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart, 2: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y = Y, weights = weights, start = start,
2009 Aug 28
1
problems with strsplit using a split of ' \\\ ' : a regex problem
I have a vector of gene symbols, some of which have multiple aliases. In the case of an alias, they are separated by ' \\\ '. Here is a real world example, which would represent one element of my vector: Eif4g2 /// Eif4g2-ps1 /// LOC678831 What I would like to do is input the vector into a function and output a vector with just the first alias of each element (or, if there are no aliases,
2012 Jul 19
3
Maintaining Column names while writing csv file.
Dear R helpers, I have one trivial problem while writing an output file in csv format. I have two dataframes say df1 and df2 which I am reading from two different csv files. df1 has column names as date, r1, r2, r3 while the dataframe df2 has column names as date, 1w, 2w. (the dates in both the date frames are identical also no of elements in each column are equal say = 10). I merge these
2008 Aug 01
2
Extract Element of String with R's Regex
Hi, I have this string, in which I want to extract some of it's element: > x <- "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.669 -965.35" yielding this array [1] "211952_at" "RANBP5" "2" In Perl we would do it this way: __BEGIN__ my @needed =(); my $str = "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.669
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 ++?) >
2010 Sep 27
2
subtraction based on two groups in a dataframe
Hello I have a data set like below: plate.id well.id Group HYB rlt1 1 P1 A1 Control SKOV3hyb 0.190 2 P1 A2 Control SKOV3hyb 0.210 3 P1 A3 Control SKOV3hyb 0.205 4 P1 A4 Control SKOV3hyb 0.206 5 P1 A5 Control SKOV3hyb 0.184 385 P1 A1 ovca SKOV3hyb 0.184 386 P1 A2 ovca SKOV3hyb 0.229 387
2009 Apr 12
1
looking for one-liner for strsplit and regex
Hi, I have a line such as: myline <- " 0.100000 1.5000 0.6000 538 0.369404" and I would like to put the numbers into a vector. Some combination of tabs and spaces occur between the numbers. I tried: try1 <- strsplit(myline,"[[:blank:]]+") > try1 [[1]] [1] "" "0.100000" "1.5000"
2003 Mar 31
4
Convert char vector to numeric table
I'm a great fan of read.table(), but this time the data had a lot of cruft. So I used readLines() and editted the char vector to eventually get something like this: " 23.4 1.5 4.2" " 19.1 2.2 4.1" and so on. To get that into a 3 col numeric table, I first just used: writeLines(data,"tempfile")
2008 Aug 12
2
perl expression question
I have a string such as fileName<-"Agg.20.20.20-all-01". All I want to do is pull the "20.20.20" and the "all" as strings. Obviously, they aren't always those values. The "20.20.20" can be "30.30.30" but it's always after the . which is next to the second g in Agg and it's always the same length. The all might not always be
2010 Jul 19
3
"ACCTGMX" to "1223400" in R?
Hi, I am a newbie in R and was working on some DNA data represented as strings of A,C,T and G (also wild-character like M and X). I use the Bioconductor package in R. Currently I need to convert a string of the form "ACCTGMX" to "1223400" i.e. A is replaced by 1, C with 2, T with 3, G with 4 and any other character with a 0. I checked with 'replace' and also with a
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 Nov 11
2
strsplit (regex)
#how do I break these up into first two letters (RM), number, and then the last part #is there an easily accessible regex tutorial on the internet? v = (structure(1:122, .Label = c("RM215Temp", "RM215SpCond", "RM215DO.Conc", "RM215Depth", "RM215pH", "RM215ORP", "RM215Turbidity.", "RM215Battery", "RM215DO.",
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),"\\.") >
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
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