Displaying 20 results from an estimated 10000 matches similar to: "Regular Expression"
2011 Jun 02
2
Matrix Question
Hi,
First of all, I would like to introduce myself as I will probably have many
questions over the next few weeks and want to thank you guys in advance for
your help. I'm a cancer researcher and I need to learn R to complete a few
projects. I have an introductory background in Python.
My questions at the moment are based on the following sample input file:
*Sample_Input_File*
Creating a file with reusable functions accessible throughout a computational biology cancer project
2011 Jun 07
1
Creating a file with reusable functions accessible throughout a computational biology cancer project
Hi,
My project is set up the following way:
root directory contains the following folders:
folders: "Breast_Cancer" AND "Colorectal_Cancer" AND "Lung_Cancer" AND
"Prostate_Cancer"
I want to create a file, call it: "repeating_functions.R" and place it in
the root directory such that I can call these functions from within the
sub-folders in each
2012 Feb 28
1
Error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns than column names
Hey,
I just googled my error and many things came up. I followed the leads and
read the ?read.delim page; I tried changing header = TRUE, and row.names =
TRUE-- but I've still been having trouble fixing it, so I would greatly
appreciate any help you can provide. Here is my code:
rm(list=ls())
source("../../functions.R")
uncurated <-
2011 Sep 16
3
Problematic If-Else statement
Hi guys,
My code (next 2 lines below) isn't doing what I'm expecting it to:
tmp <-
ifelse(uncurated$days_to_tumor_recurrence=="null","norecurrence","recurrence")
curated$recurrence_status <- tmp
I want the column "recurrence_status" in my output file to have values
"recurrence" (if the input value had a number in the
2012 Feb 29
3
regular expression
Computer Friends,
with the following example lines:
[107] "98-610: Cell type: S; Surv(months): 6; STATUS(0=alive, 1=dead): 1"
[108] "99-625: Cell type: S; Surv(months): 21; STATUS(0=alive, 1=dead): 1"
i want to be able to isolate the number of months of survival for each row.
is there a regular expression that can find the first instance of a ";",
delete
2012 Aug 10
2
Regular Expressions + Matrices
Hi all,
My code looks like the following:
inname = read.csv("ID_error_checker.csv", as.is=TRUE)
outname = read.csv("output.csv", as.is=TRUE)
#My algorithm is the following:
#for line in inname
#if first string up to whitespace in row in inname$name = first string up
to whitespace in row + 1 in inname$name
#AND ID in inname$ID for the top row NOT EQUAL ID in inname$ID for the
2013 Jan 30
2
substring from behind
Hello together,
i have a question for "substring".
I know i can filter a number like this one:
bill$No<-substring(bill$Customer,2,4)
in this case i get the 2nd, 3rd and 4th number of my Customer ID.
But how can i do this, if i want the 2nd, 3rd and 4th number of a column.
Like this one.
I have: Mercedes_02352
Audi_03555
and now i want to filter this data.frame to
235
355
can you
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"
2012 Jul 12
6
read.table with numeric row names
I have a text file like this
2.5 3.6 7.1 7.9
100 3 4 2 3
200 3.1 4 3 3
300 2.2 3.3 2 4
I used "r <- read.table("a.txt", header=T)"
The row names becomes X2.5, X3.6... What I need is the row names are
numeric, so I can use the row names as numbers on x-axis for plotting. e.g.
"plot(colMeans(r)~names(r))",
2018 Nov 29
2
Best way of merging mbox files
When concatenating mbox files like described here
https://xaizek.github.io/2013-03-30/merge-mbox-mailboxes/. You will end
up with an 'unsorted' mbox file. Is this going to be a problem
esspecially when they are large >2GB's and new emails will be written to
it?
The email client nicely sorts the message from folder A "foldera 5 last"
as last, but of course the mbox is
2013 Apr 11
2
group data
Hey,
I have a dataset and I want to identify the records by groups for further
use in ggplot.
Here is a sample data:
ID Value
AL1 1
AL2 2
CA1 3
CA4 4
I want to identify all the records that in the same state (AL1 AND A2),
group them as "AL", and do the same for CA1 and CA4. How can I have an
output like:
ID Value State
AL1 1 AL
AL2 2 AL
CA1 3 CA
CA4 4
2010 Feb 08
2
the hat ^ in regular expression
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100208/52a6d080/attachment.pl>
2012 Aug 16
8
How to extract from a column in a table?
Hi,
I have a table in which one column has the name of the objects as shown below.
Name
Budlamp-Woodcutter Complex - 15 to 60% slope (60/25/15)
Budlamp-Woodcutter Complex - 15 to 60% slope (60/25/15)
Terrarossa-Blacktail-Pyeatt Complex - 1 to 40% slope (40/35/15/10)
Terrarossa-Blacktail-Pyeatt Complex - 1 to 40% slope (40/35/15/10)
How can I split the single column into three columns
2012 Oct 23
3
frequency
Hello,
I have a data as follow:
ID Visit
xa1
xa2
yb1
yc23
yb33
I want to look at frequency of visit for ID and create a new column as response .
For example my response would be 2 for x and 3 for y.
I think I need to write a loop, but I don't know how.
I really appreciate your help.
Thanks a lot.
Best,Farnoosh Sheikhi
[[alternative HTML version deleted]]
2012 Nov 24
3
Designating a new year (Sept-Aug) in R
If I have data (below) and need some help in figuring out how I can change the values of my date column, so that a year will be from September-August? So the year
1990 = September 89-August 90; 1991
= September 90-August 91, etc...
I was trying to use the if() function, but am unable to figure it out. I basically need to change the years associated with September-December to the following
2012 Aug 31
7
splits with 0s in middle columns
Hi,
A column of my df looks like
A
10/20/30
40/20
60/10/10/5
80/10
I want to split it such that the last column has the last composition and if there are not enough the middle columns get the 0s. That way my df would look like
A1 A2 A3 A4
10 20 0 30
40 0 0 20
60 10 10 5
80 0 0 10
How can I do that ??
[[alternative HTML version deleted]]
2016 Apr 25
3
Please assist -- Unable to remove '-' character from char vector--
Hi,
I have a char vector with year values. Some cells have single year
value '2001-' and some have range like 1996-2007.
I need to remove hyphen character '-' from all the values within the
character vector named as 'end'. After removing the hyphen I need to
get the last
number from the cells where there are year range values i.e if the
cell has range 1996-2007, the code
2013 Jan 23
4
extracting characters from a string
Dear All,
I have a data frame of vectors of publication names such as 'pub':
pub1 <- c('Brown DK, Santos R, Rome DF, Don Juan X')
pub2 <- c('Benigni D')
pub3 <- c('Arstra SD, Van den Hoops DD, lamarque D')
pub <- rbind(pub1, pub2, pub3)
I would like to construct a dataframe with only author's last name and each last name in columns and the
2007 Dec 03
1
Plotting monthly timeseries with an x-axis in "time format"
I have the following timeseries "tab"
=====================================
> str(tab)
mts [1:23, 1:2] 79.5 89.1 84.9 75.7 72.8 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:2] "Ipex...I" "Omel...E"
- attr(*, "tsp")= num [1:3] 2006 2008 12
- attr(*, "class")= chr [1:2] "mts" "ts"
> tab
2010 Aug 09
3
Regular Expression
Hi all,
>From a list of strings, I desire to filter out the followings:
1. Digits at the beginning of the strings
2. Character "SPE" following the digits (if it exists)
3. Any characters followed by hyphen
The following produces the desired result, but would like to know whether
this can be done more efficiently.
Any suggestions would be much appreciated.
dat <- c("2148