search for: yourlist

Displaying 17 results from an estimated 17 matches for "yourlist".

2012 Mar 16
3
Faster way to implement this search?
I am working on a simulation where I need to count the number of matches for an arbitrary pattern in a large sequence of binomial factors. My current code is for(indx in 1:(length(bin.05)-3)) if ((bin.05[indx] == test.pattern[1]) && (bin.05[indx+1] == test.pattern[2]) && (bin.05[indx+2] == test.pattern[3])) return.values$count.match.pattern[1] =
2009 Nov 03
3
re ading tokens
Greetings, I am not familiar with processing text in R. Can someone tell me how to read each line of words as separate elements in a list? FE, I would like to turn: word1 word2 word3 word2 word4 into a list of length two with three character elements in the first list and two elements in the second. I know that this should be easy, but I am a little confused by the text functions. Thanks in
2012 May 25
2
Collecting results of a test with array
Dear contributors I have tried this experiment: x<-c() for (i in 1:12){ x[i]<-list(cbind(x1[i],x2[i])) #this is a list of 12 couples of time series I am using to perform a test } # that compares them 2 by 2 # ################# #trace statistic test<-data.frame() cval<-array( , dim=c(2,3,12)) for (i in 2:12){ for (k in 1:2){ for (j in 1:3){ result[k,j,i]<-
2004 May 28
2
Simple list manipulation question
I have a list of vectors $A "AB" "BC" "CD" $B "GF" "HG" "FH" "FJ" and I want to convert it into a dataframe of form A AB A BC A CD B GF B HG B FH B FJ Just can't quite come up with a nice "R" solution for it. Thanks, Sean
2008 Feb 16
2
Adding elements to existing lists
Dear everybody! Is there a command to add elements to an existing list, at best excluding the addition of already included ones? Thank you in advance. Yours, Mag. Ferri Leberl
2010 Apr 13
1
lapply - function with arguments
Dear R users, I have created a function f of n, a and b : f(n,a,b) I would like to apply this function several times to some values of n. a and b are held constant. I was thinking of using lapply. How can I do this ? Thank you very much Randall [[alternative HTML version deleted]]
2010 Apr 28
1
how to remove the names in the list result
hi,everybody: I get a list as following. For each element of the list, it has names such as "Var1" and "Freq". May I ask how to remove them? And, may I ask how to make them form a matrix such as like concatinating them? Thank you! The list I got: [[1]] Var1 Freq 1 -5.20726501684368 19 2 1.89099344331540 31 [[2]] Var1
2012 Jun 26
2
flatten lists
I am looking for a function to flatten a list to a list of only 1 level deep. Very similar to unlist, however I don't want to turn it into a vector because then everything will be casted to character vectors: x <- list(name="Jeroen", age=27, married=FALSE, home=list(country="Netherlands", city="Utrecht")) unlist(x) This function sort of does it: flatlist
2013 Sep 10
1
merge two lists by column
Hello I have done resampling from a matrix data with two variables (A,B). After resampling a get a set of lists (see below example for resample size 2). In both lists I have the same two variables (A,B). I want to export this data to an excel file where I have only two columns, one per variable. Thus, stack the data for variable A in a single column and the same for variable B. I have tried to
2009 Aug 17
1
how to pass more than one argument to the function called by lapply?
Dear R helpers: I wonder how to pass more than one argument to the function called by lapply. For example, #R code below --------------------------- indf <- data.frame(id=I(c('a','b')),y=c(1,10)) #I want to add an addition argument cutoff into the function called by lapply. outside.fun <- function(indf, cutoff) { unlist(lapply(split(indf, indf[,'id']),
2004 Sep 16
5
Indexing lists
DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. --- [[alternative HTML version deleted]]
2009 Nov 19
2
Efficient cbind of elements from two lists
Hi! I have a data.frame "data" and splitted it. data <- split(data, data[,1]) This is a quite slow procedure; and I do not want to do it again. So, any unsplit and "resplit" is no option for me. But: I have to cbind "variables" to the splitted data from another list, that contains of vectors with matching sizes, so for (i in 1:length(data)) { data[[i]]
2005 Feb 03
5
How to convert a list to a matrix
Hi Sorry to ask such a basic question. I have a list, each element of which is a vector of two values. What I actually want is a matrix with two columns, and one row per element of the list. Obviously I have tried as.matrix(), and as.vector() but I didn't expect the latter to work. I feel so lame asking this. Any suggestions? Mick
2011 Feb 20
2
concatenate vector after strsplit()
ls is a list of character vectors created by strsplit() I want to concatenate the 1st 4 character elements of each list item as a new vector called file. I admit to being confused about list syntax even after numerous readings. Here's what I tried: ls <- list(c("Focused", "10k", "A12", "t04.tif", "+", "µm"),
2010 May 20
4
max number from a list of numbers
Hi all, I'm hoping this question has a simple answer, but I can't find it through searching or trying commands. I have a list of numeric vectors called 'husk'. I'd just like to treat the set of all numbers from all vectors in the list as if it were one large vector, because I'd like to extract information, such as what is the max entry from all the numbers. > husk
2009 Mar 04
5
Filtering R lists
Hello I am am new to R and any help with the following would be appreciated: I have a list (example attached) and I would like to create a new list which is a filtered version of this list. I.e I would like a list that only contains elements with this value: Chr 10 : 21853562 - 21855482 Any pointers/tips would be great. Thanks! Nikol -- Bioinformatician/Computer Associate Cambridge Institute
2008 Aug 22
2
Combining multiple datasets
Hi, I've tried to figure this out using Intro to R and help(), to no avail - I am new at this. I'm trying to write a script that will read multiple files from a directory and then merge them into a single new data frame. The original data are in a tree-ring specific format, and so I've first used a function (read.rwl) from the dplR package to read each file, translate each into a