Displaying 20 results from an estimated 8000 matches similar to: "how to view the top 20 lines in a long dataset"
2012 Apr 18
3
how to plot separate lm ablines on the same xyplot by group
Hi,
I am trying to use xyplot to plot the relationship between size and day
(y~x) by a food factor that has two levels, low and high. I have 3 reps per
factor/day. I want the plots from each food treatment on the same axiss,
so I used this code:
xyplot(Size ~ Day, groups = Food, data = louis.data.means,col=1,
pch=c(1,17),
panel=function(x,y,groups,...){
panel.superpose(x,y,groups,...)
2011 Apr 13
2
setting pairwise comparisons of columns
Hi,
I have a number of genes (columns) for which I want to examine pairwise
associations of genotypes (each row is an individual)...For example (see
data below), I would like to compare M1 to M2, M2 to M3, and M1 to M3 (i.e.
does ac from M1 tend to be found with bc from M2 more often than expected.)
Down stream I will be performing chi square tests for each pair.
But I am looking for a way to
2006 May 08
3
Non repetitive permutations/combinations of elements
Hello all,
I am trying to create a matrix of 1s and -1s without any repetitions for a
specified number of columns.
e.g. 1s and -1s for 3 columns can be done uniquely in 2^3 ways.
-1 -1 -1
-1 -1 1
-1 1 -1
-1 1 1
1 -1 -1
1 -1 1
1 1 -1
1 1 1
and for 4 columns in 2^4 ways and so on.
I finally used the function combn([0 1],3) that I found at the following link
2007 Apr 10
1
R CMD Rdconv drops sections: arguments, seealso, examples (PR#9606)
I've created a .Rd file (below), then converted that to .sgml using
R CMD Rdconv --type=Ssgm combn.Rd > combn.sgml
The output (shown below) is missing some of the sections:
arguments
seealso
examples
If instead I convert to .d (below), the same sections are missing,
and the "note" section is included but without the necessary newline.
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
2007 Apr 20
1
simply this loop?
Hi, anyone interested in this:
I tried to simply this loop with lapply or something but haven't figured it out:
mapt = c("203929_s_at", "203930_s_at", "203928_x_at", "206401_s_at")
mapt.combn <- lapply(1:4, function(i) combn(mapt, i))
out = list()
k = 1
for (i in 1:length(mapt.combn)){
for (j in 1:ncol(mapt.combn[[i]])){
out[[k]] =
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,
2013 Sep 06
1
Importing function that is previously imported by other package
Dear developeRs,
I encounter the following problem: in the current version of my package
FrF2, certain calls to a functioni do not work when package combinat is
loaded, because function combn from combinat masks the function from
utils that my package uses.
I tried to solve this issue by importing function combn into the
namespace of FrF2; I don't need to export it, I just want to use it
2010 Nov 17
1
efficient conversion of matrix column rows to list elements
Hi List,
I'm hoping to get opinions for enhancing the efficiency of the following
code designed to take a vector of probabilities (outcomes) and calculate a
union of the probability space. As part of the union calculation, combn()
must be used, which returns a matrix, and the parallelized version of
lapply() provided in the multicore package requires a list. I've found that
2006 Oct 06
1
Sum of Bernoullis with varying probabilities
Hi Folks,
Given a series of n independent Bernoulli trials with
outcomes Yi (i=1...n) and Prob[Yi = 1] = Pi, I want
P = Prob[sum(Yi) = r] (r = 0,1,...,n)
I can certainly find a way to do it:
Let p be the vector c(P1,P2,...,Pn).
The cases r=0 and r=n are trivial (and also are exceptions
for the following routine).
For a given value of r in (1:(n-1)),
library(combinat)
Set <- (1:n)
2010 May 08
2
apply a function on elements of a list two by two
Dear all,
I want to apply a function to list elements, two by two. I hoped that combn
would help me out, but I can't get it to work. A nested for-loop works, but
seems highly inefficient when you have large lists. Is there a more
efficient way of approaching this?
# Make some toy data
data(iris)
test <- vector("list",3)
for (i in 1:3){
x <- levels(iris$Species)[i]
tmp
2006 Jan 30
2
yet another vectorization question
Dear R-helpers,
I'm trying to develop a function which specifies all possible expressions that
can be formed using a certain number of variables. For example, with three
variables A, B and C we can have
- presence/absence of A; B and C
- presence/absence of combinations of two of them
- presence/absence of all three
A B C
1 0
2 1
3 0
4 1
5 0
6 1
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
2010 Apr 07
1
combn with factors
Dear list,
I have come across this issue:
combn(letters[1:5], 3)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] "a" "a" "a" "a" "a" "a" "b" "b" "b" "c"
[2,] "b" "b" "b" "c" "c" "d" "c"
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.
2009 Apr 06
3
how to subsample all possible combinations of n species taken 1:n at a time?
Hello
I apologise for the length of this entry but please bear with me.
In short:
I need a way of subsampling communities from all possible communities of n
taxa taken 1:n at a time without having to calculate all possible
combinations (because this gives me a memory error - using
combn() or expand.grid() at least). Does anyone know of a function? Or can
you help me edit the
combn
or
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 Apr 04
5
Creating multiple vector/list names-novice
Hi I have very simple issue as I am still new to the group of R
I have basically
vector of names for which i want to create mutliple combinations and then
place them in different vectors. In some other language I can just place a
third dimension to separate list (or matrix) but i do not know how to do it
in R.
My issue is simple I use
cc<-combn(colnames(DD),2)
I would need to have this
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 Jul 03
1
Problem in applying conditional looping
Respected All,
I hope you are enjoying good health, I am tring to write a program in R but
could not be very sucessful. My program draws random sample form bivariate
normal distribution and then compute a variable PIJ. For certian samples
some entries of variable PIJ is apearing as negative, which result
in negative variance estimator. I want to introduce a loop in my program
that verify the each