Displaying 20 results from an estimated 6000 matches similar to: "Looping through all possible combinations of cases"
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
2008 Jun 11
5
Similar words
Is there a way to get a list of similar words to the ones a user has
searched for?
So if they search for (in my case) transferaze which has no matches I
can get back an array like this [''transferase''] ?
I know I can just add ~ on the end to make it fuzzy, but what I''d like
is to be able to say "Sorry, no matches for ''transferaze''. Did you
2011 Mar 30
2
summing values by week - based on daily dates - but with some dates missing
Dear everybody,
I have the following challenge. I have a data set with 2 subgroups,
dates (days), and corresponding values (see example code below).
Within each subgroup: I need to aggregate (sum) the values by week -
for weeks that start on a Monday (for example, 2008-12-29 was a
Monday).
I find it difficult because I have missing dates in my data - so that
sometimes I don't even have the
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
2010 Aug 04
6
applying strsplit to a whole column
I am sorry, I'd like to split my column ("names") such that all the
beginning of a string ("X..") is gone and only the rest of the text is
left.
x<-data.frame(names=c("X..aba","X..abb","X..abc","X..abd"))
x$names<-as.character(x$names)
(x)
str(x)
Can't figure out how to apply strsplit in this situation - without
using a
2009 Jan 29
1
Multiple tables
Dear list,
I have a set of 100+ variables. I would like to have one by one crosstables for each variable. I started with
table(variable1, variable2)
table(variable1, variable3)
table(variable1, variable4)
...
table(variable2, variable3)
table(variable2, variable4)
...
It seems rather tedious.
Any better ideas around?
Thanks for any help!
Gerit
--
NUR NOCH BIS 31.01.! GMX FreeDSL -
2008 Jul 31
1
combinations with replications
Dear all,
Is there a way to compute and list all combinations with replication of two
elements in sets of 8 elemnts?
For example, I've two elements, 0 and 1, and I would to get all possible
combinations with replication such as, for example, 00000000, 00000001,
00000010, and so on. They are 2^8 and it's very hard to list handly!!
Thank you
Marina
--
View this message in context:
2009 Mar 20
2
A category reduction problem
I am trying to print out a list of strings of length 11 based on
integers 0 through 10. The rules as given to me for the ordering are:
The first digit must be 0.
The 2nd digit must be 0 or 1.
The 3rd digit must equal the 2nd digit or the 2nd digit +1.
...
Given the final digit, n, all digits 0 through n must appear in a given
sequence.
So the final 1024 item list should look like
0 1 2 3 4 5
2010 Apr 24
2
multiple paired t-tests without loops
I am new to R and I suspect my problem is easily solved, but I haven't
been able to figure it out without using loops. I am trying to
implement Blair & Karniski's (1993) permutation test. I've included a
sample data frame below. This data frame represents the conditional
means (C1, C2) for 3 subjects in 2 consecutive samples of a continuous
data set (e.g. ERP waveform).
2006 Jul 25
12
DRYing - similar named fields, etc.
I''m sorry - just couldn''t come up with a subject that describes the
problem :(
Anyway, this is my problem. I have a long list of fields that need to
be displayed when a ''show'' is requested on the controller. I''m now
doing the list.rhtml and looking for a DRY way to do the following.
For each data item, I have 2 fields - one is the item name, the
2006 Nov 09
2
Algorithm needed
I have a matrix of size "n" and I want to create a new one in which the columns
are sums of the original matrix, with some order in the sums. For example, if
matrix A has 4 columns, then the new matrix should have 6 columns with the
following info from the columns of A: 1+2, 1+3, 1+4, 2+3, 2+4, 3+4. If matrix A
has 5 columns, then the new matrix has 10 columns: 1+2, 1+3, 1+4, 1+5, 2+3,
2009 Sep 17
3
generating unordered combinations
Hi,
I am trying to generate all unordered combinations of a set of
numbers / characters, and I can only find a (very) clumsy way of doing
this using expand.grid. For example, all unordered combinations of
the numbers 0, 1, 2 are:
0, 0, 0
0, 0, 1
0, 0, 2
0, 1, 1
0, 1, 2
0, 2, 2
1, 1, 1
1, 1, 2
1, 2, 2
2, 2, 2
(I have not included, for example, 1, 0, 0, since it is equivalent to
0, 0, 1).
I have
2008 Sep 05
1
binary order combinations
Dear all!
I have a vector of names
names<-("V1", "V2", "V3",....., "V15")
I could create all possible combinations of these names (of all
lengths) using R:
combos<-lapply(1:15,function(x)
{combn(names,x)
})
I get a list with all possible combinations of elements of 'names'
that looks like this (just the very beginning of it):
[[1]] - the
2013 Mar 25
2
Faster way of summing values up based on expand.grid
Hello!
# I have 3 vectors of values:
values1<-rnorm(10)
values2<-rnorm(10)
values3<-rnorm(10)
# In real life, all 3 vectors have a length of 25
# I create all possible combinations of 4 based on 10 elements:
mycombos<-expand.grid(1:10,1:10,1:10,1:10)
dim(mycombos)
# Removing rows that contain pairs of identical values in any 2 of
these columns:
mycombos<-mycombos[!(mycombos$Var1
2012 Sep 10
2
pairwise comparisions
Hi ,
I am new to R . I am facing difficulty how to make pairwise comparisions.
For example. I have a file which looks like below
a b c d
x 3 6 7 6
y 7 8 6 5
z 5 4 7 8
Here I need to look for the each pairwise comparisions (ab,ac,ad,bc,bd,cd
for each row)
For instance ,looking at first row, for x i need to look for ab values and
take the min(3,6) >5 ,if its satistfies the count should be
2012 Jul 20
6
Speeding up a loop
General problem: I have 20 projects that can be invested in and I need to
decide which combinations meet a certain set of standards. The total
possible combinations comes out to 2^20. However I know for a fact that the
number of projects must be greater than 5 and less than 13. So far the the
code below is the best I can come up with for iteratively creating a set to
check against my set of
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
2010 Dec 22
3
A question to get all possible combinations
Let say, I have a matrix with 8 rows and 6 columns:
> df1 <- matrix(NA, 8, 4)
> df1
[,1] [,2] [,3] [,4]
[1,] NA NA NA NA
[2,] NA NA NA NA
[3,] NA NA NA NA
[4,] NA NA NA NA
[5,] NA NA NA NA
[6,] NA NA NA NA
[7,] NA NA NA NA
[8,] NA NA NA NA
Now I want to get **all possible** ways to fetch 6 cells at a
2008 Mar 13
3
fast way to compare two matrices of combinations
I have a list (length 750), each element containing a vector of unique
strings (unique gene ids), with length up to ~40 (median 15). I want to
compile a matrix of all possible triplets and their frequency within
gene elements. Using combn and a lot of looping, I am accomplishing this
but it is VERY slow.
I've tried to figure out a way to vectorize this, using "match" and
2005 Apr 03
3
is there a function like %in% for characters?
like:
"a" %in% "abcd"
TRUE
Thanks.