similar to: R help!

Displaying 20 results from an estimated 30000 matches similar to: "R help!"

2010 Jan 18
3
Using the output of strsplit
I successfully combined my data frames, and am now on my next hurdle. I had combined the data and quarter, and used tapply to count the entries for each unique date/quarter pair. ar= tapply(ewrgnd$gw, list(ewrgnd$dq), sum) #for each date/quarter combination sums the gw (which are all 1) dq=row.names(ar) spl=strsplit(dq) But I need to split them back into the separate date and quarter. So I used
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]
2006 Nov 20
2
problem with loop to put data into array with missing data for some files
Dear R-help community, My main goal of this message is to find a way of skipping a file of a month/year in a loop that does not exist (and making it's output into an data.out array would be NA) and moving onto the next year/month in the loop to carry on filling data.out with real precipitation data. The situation so far: I downloaded 50 years worth of GRIB data files from the NCEP data
2006 Nov 20
3
problem with loop to put data into array with missing data forsome files
Hi Jenny If you want a general solution I understand. However I just downloaded the file fine (as far as I can tell) so you are welcome to have a copy. I can email it to you if you want. I do not think your test for NA is valid. i.e if(test != "NA"){ } I think you should use if(is.na(test)){ } Or something similar. J --- John Seers Institute of Food Research Norwich
2005 May 17
2
how to use list index to get vector
I have a simple question, but I couldn't find the answer in R manuals. Assume I have a list: > foo <- list() > foo[[1]] <- c(1, 2, 3) > foo[[2]] <- c(11,22,33) > foo[[3]] <- c(111,222,333) > foo [[1]] [1] 1 2 3 [[2]] [1] 11 22 33 [[3]] [1] 111 222 333 How to use list index to get a vector of, say, the first elements of list elements? That is, how to get a vector
2006 Apr 11
2
About list to list - thanks
Thank you very much for your useful suggestions. These are exactly what I was looking for. foo <- list(foo1, foo2, foo3) lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE)) or lapply(foo, function(x) do.call('rbind', x)) Best, Muhammad Subianto On 4/11/06, Muhammad Subianto <msubianto at gmail.com> wrote: > Dear all, > I have a result my experiment
2011 Nov 17
1
how to read a free text file into individual variables
hi ,I am writing a soft package based on R. But when I try to read a configure file showed as below. How can I read the parameter in this text file. How can I read the parameter into each variable in this file ? configinfo<-scan(file(configfile),ok=TRUE,n=-1) scan seems need every line have same column ? configinfo <- readLines(configfile,ok=TRUE,n=-1) methodnum <-
2012 Jul 07
11
Splitting a character vector.
I am lousy at simple regex and I have not found a solution to a simple problem. I have a vector with some character values that I want to split. Sample data dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)", "ALP (max jack)") Desired result dd2 <- data.frame( xx = c("XXY", "XXY", "CAMP",
2009 Nov 04
2
splitting scientific names into genus, species, and subspecies
I have a list of scientific names in a data set. I would like to split the names into genus, species and subspecies. Not all names include a subspecies. Could someone show me how to do this? My example code is: a <- matrix(c('genusA speciesA', 10, 'genusB speciesAA', 20, 'genusC speciesAAA subspeciesA', 15,
2017 Aug 22
2
splitting a dataframe in R based on multiple gene names in a specific column
I would appreciate please a suggestion on how to do the following : i'm working with a dataframe in R that contains in a specific column multiple gene names, eg : > df.sample.gene[15:20,2:8] Chr Start End Ref Alt Func.refGene Gene.refGene284 chr2 16080996 16080996 C T ncRNA_exonic GACAT3448 chr2 113979920 113979920 C T ncRNA_exonic LINC01191,LOC100499194465
2017 Aug 23
0
splitting a dataframe in R based on multiple gene names in a specific column
Hi Bogdan, Messy, and very specific to your problem: df.sample.gene<-read.table( text="Chr Start End Ref Alt Func.refGene Gene.refGene 284 chr2 16080996 16080996 C T ncRNA_exonic GACAT3 448 chr2 113979920 113979920 C T ncRNA_exonic LINC01191,LOC100499194 465 chr2 131279347 131279347 C G ncRNA_exonic LOC440910 525 chr2 223777758 223777758 T A
2017 Aug 25
1
splitting a dataframe in R based on multiple gene names in a specific column
If row numbers can be dispensed with, then tidyr makes this easy with the unnest function: ##### library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union library(purrr)
2009 May 07
1
extending strsplit to handle missing text that doesn't have the target on which to split
I am sure there is an obvious answer to this that I'm missing but I can't find it. I'm parsing headers of Emails and most have a date like this: "Wed, 16 Nov 2005 05:28:00 -0800" and I can parse that using: tmp.dat.data <- matrix(unlist(strsplit(headers$Date.line,",")), ncol = 2, byrow = TRUE) before going on to look at the day and date/time data.
2008 Aug 27
2
problems formating scientific collaboration data
Hello all and thanks in advance for any help or direction. I have co-authorship data that looks like: Paper Author Year 1 SmithKK JonesSD 2008 2 WallaceAR DarwinCA 1999 3 HawkingS 2003 I would like: Paper Author Year 1 SmithKK 2008 1 JonesSD 2008 2
2017 Jul 21
1
a difficult situation, how to do this using base function.
Hello, I have a following dataframe with many rows. data.frame(match.start=c(5,10,100,200),range.coordinates=c("1000-1050","1500-1555","5000-5050,6000-6180","100-150,200-260,600-900")) match.start range.coordinates 5 1000-1050 10 1500-1555 100 5000-5050,6000-6180 200
2012 Nov 26
3
Help in splitting the records
Hi I have set of records seperated by a separator say "$$$" i want to get the values in a dataframe. eq qwer$$12$$qwre ewrtr$7789$ewwe I want the output as\ V1 V2 V3 qwer 12 qwre ewrtr 7789 ewwwe Please help me ----- Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/Help-in-splitting-the-records-tp4650827.html Sent from
2004 Aug 08
2
manipulating strings
Hi I have a called fil consisting of the following strings. > fil [1] " 102.2 639" " 104.2 224" " 105.1 1159" " 107.1 1148" " 108.1 1376" [6] " 109.2 1092" " 111.2 1238" " 112.2 349" " 113.1 1204" " 114.1 537" [11] " 115.0 303" " 116.1 490"
2012 Apr 22
2
how to avoid newlines & tabs in file opening?
i have uploaded file,but when i am opening it in R,using > u<-file(file.choose(),"r") >k<-readLines(u) >k > k[1:120] is has all /t (tabs)& newlines, how to avoid it, can i take first 3 columns only in table form (lines starts with # not important for me) uploaded file:- http://r.789695.n4.nabble.com/file/n4577757/rabata.txt rabata.txt -- View this message in
2012 Jan 10
1
Converting BY to a data.frame
Hello, I am trying to convert BY to a data frame, consider the following example: exampleDF<-data.frame(a=c(1,2),b=c(10,20),name=c("first","second")) exampleBY<-by(exampleDF,with(exampleDF,paste(a,b,sep="_")),               function(x) {                 data.frame(                     name=as.character(x$name),                     a=x$a,                    
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 "("