similar to: combn with factors

Displaying 20 results from an estimated 4000 matches similar to: "combn with factors"

2009 Jun 26
2
Indexing a list with a list
Dear list, I have two lists: one with data and one with TRUE/FALSE values for data I want to further analyze (see example below). I have been able to use a for loop to extract the data that I want to keep, but think that there probably exists a way to do it without a loop. Any ideas? #sample data set.seed(100) example = list(letters[1:10], letters[1:10], letters[1:10]) ind =
2011 May 13
1
period in scale parameter of prcomp
Hi all, Looking at the help file for prcomp and the code in stats:::prcomp.default, the scale parameter for the default S3 method has a trailing period: it written as scale. I assume there is a reason for it (backwards compatibility with S was suggested) but I thought I'd ask. Thanks, Greg -- Greg Hirson ghirson at ucdavis.edu Graduate Student Agricultural and Environmental Chemistry
2010 Jan 05
2
Fast nested List->data.frame
I have very large data sets given in a format similar to d below. Converting these to a data frame is a bottleneck in my application. My fastest version is given below, but it look clumsy to me. Any ideas? Dieter # ----------------------- len = 100000 d = replicate(len, list(pH = 3,marker = TRUE,position = "A"),FALSE) # Data are given as d # preallocate vectors pH =rep(0,len) marker
2009 Jul 08
2
Simple monovariate classification?
I'm looking for an R function that simply recodes a quantitative variable into a number of classes according to specified break-points. Obviously I can do this using nested ifelse() commands, but I want to write it into a function where I can't pre-specify the number of classes. Is there an obvious way to do this? An example to clarify: how to convert c(0,10,5,1,9,6) to
2009 Dec 11
3
Correcting for missing data combinations
I can think of many brute-force ways to do this outside of R, but was wondering if there was a simple/elegant solution within R instead. I have a table that looks something like the following: Factor1 Factor2 Value A 11/11/2009 5 A 11/12/2009 4 B 11/11/2009 7 B 11/13/2009 8 >From that I need to generate all permutations of Factor1 and Factor2 and force a 0 for any combination that doesn?t
2010 Mar 26
2
More efficient alternative to combn()?
Hi, i am working on a problem where i need to compute the products of all possible combinations of size m of the elements of a vector. I know that this can be achieved using the function combn(), e.g.: > vector <- 1:6 > combn(x = vector, m = 3, FUN = function(y) prod(y)) In my case the vector has 2000 elements and i need to compute the values specified above for m = 32. Using combn() i
2012 Nov 16
1
pairing data using combn with criteria
Dear All, I have a dataframe made up of individual beetles consisting of individual number, family number, mother's family number, father's family number, and sex of the beetle. I would like to pair up the individuals for breeding. I would, however, like to avoid breeding beetles of the same sex (obviously), the same family, and with the same mother's family or father's family,
2011 Oct 16
1
multicore combn
This is a 'rather than re-invent the wheel' post. Has anyone out there re-written combn so that it can be parallelized - with multicore, snow, or otherwise? I have a job that requires large numbers of combinations, and rather than get all of the index values, then crank it through mclapply, I was wondering if there was a way to just do this natively within a function. Just curious.
2006 May 09
1
combn(n, k, ...) and all its re-inventions
It seems people are reinventing the wheel here: The goal is to generate all combinations of 1:n of size k. This (typically) results in a matrix of size k * choose(n,k) i.e. needs O(n ^ k) space, hence is only applicable to relatively small k. Then alternatives have been devised to generate the combinations "one by one", and I think I remember there has been a quiz/challenge about 20
2009 Sep 21
2
Combine vectors in order to form matrixes with combn
Hello! I've a problem with the combn function and a set of vector. I would like to make a simple combination where, instead of scalars, i would like to combine vector, in order to form matrixes. In other words, i have nineteen 6-items vectors (for example coef1-coef19), that i would like to combine in n!/k!(n-k)! 6x6 matrixes. I tried with a code like this mma <-
2011 Jan 10
1
Using combn
Dear list, I want to apply the "table" function to every pair of variables in df and the return should be a list. setwd(123) asd <- data.frame(a1=sample(1:4, 20, replace=TRUE), a2=sample(1:4, 20, replace=TRUE), a3=sample(1:4, 20, replace=TRUE), a4=sample(1:4, 20, replace=TRUE)) with(asd, table(a1, a2)) with(asd, table(a1,
2008 Feb 08
2
Applying lm to data with combn
http://www.nabble.com/file/p15359204/test.data.csv http://www.nabble.com/file/p15359204/test.data.csv test.data.csv Hi, I have used apply to have certian combinations, but when I try to use these combinations I get the error [Error in eval(expr, envir, enclos) : object "X.GDAXI" not found]. being a novice I donot understand that after applying combination to the data I cant access
2013 Jan 24
2
Please help R error message "masked from 'package:utils':combn"
Hi The message occurred from R, when I was selected of "optimization > block diagonal Fhiser matrix" and used the attached file on PFIM. Could you please advise me about the following message? ***************************** Loading required pakage: combinat Attaching package:'combinat' The following object(s) are masked from 'package:utils':combn
2007 Mar 27
2
Newbie: Combn and scripting
Hello All, I have just installed my R 2.4 (windows) as a test trying to load a data frame and run combn() for each line into another file. How do I do this? data.csv: a,b,c,d 1,2,3.4 g,3,6,t etc x=data.csv, m=3 Thank you Zam _________________________________________________________________________________ This email contains confidential information intended only for the person named
2007 Jan 19
2
combn implementation
Hi, I was checking the source code to the function combn that "generates all combinations of the elements of 'x' taken 'm' at a time.", because I wished to modify it. I have a doubt about a statement. This is the main loop. ._1 <- 1:1 nmmp1 <- n - m + ._1 while (a[1] != nmmp1) { if (e < n - h) { h <- ._1 e <-
2009 Jul 10
2
to get the R-Squared value
Dear all, I know there are 'coef', 'predict', 'fit' to get the corresponding outputs. Is that possible to get the value of R-squared from a 'lm' output? Many thanks.
2009 Sep 08
1
Plotting two qqnorm plots:
Hi all, Does anyone know how to plot overlapping qqnorm plots on the same window? Suppose I have data in the vector x and y: qqnorm(x) lines(qqnorm(y)) I though these two lines will do the job... However, lines doesn't seem to work. Anyways, thanks in advance! -- View this message in context: http://www.nabble.com/Plotting-two-qqnorm-plots%3A-tp25352893p25352893.html Sent from the R help
2010 Feb 18
1
Shapiro-Wilk test problem
Hi everybody, Does anyone know what problem may be with this test. I am applying 5 different normality tests and use p-values for them, but for some reason S-W gives me NA, while sample size is 100. Any ideas? Thanks a lot! [[alternative HTML version deleted]]
2011 May 16
1
help: Using hotelling for a confidence region for PCA scores
Hello everyone. In my last post I did not explained my problem quite well. I made a principal component analysis and took the 2 first principal components. I made ​​a chart of my points based on the score of the 2 PC. I would like to add on this graph a 95% confidence region. To do this I used the ellipse function as follows: pcsref=PC$score[data[,1]==ref,1:2] #matrix containing the scores
2010 Jan 09
3
string functions
Hi! Does anybody know a string function that would calculate how many characters two strings share? I.e. ("Hello World","Hello Peter") would be 7. Thanks. Laetitia