Displaying 20 results from an estimated 9000 matches similar to: "functions for subsets: a minor R programming challenge"
2010 Sep 13
2
post
Hello,
I have a question regarding how to speed up the t.test on large dataset. For example, I have a table "tab" which looks like:
a b c d e f g h....
1
2
3
4
5
...
100000
dim(tab) is 100000 x 100
I need to do the t.test for each row on the two subsets of columns, ie to compare a b d group against e f g group at each row.
subset 1:
a b d
1
2
3
4
5
...
100000
2005 Oct 03
1
storage.mode, C data types and speed
Hi,
I am trying to speed up part of an algorithm in which certain columns of a large matrix (X) are replaced by the element-wise product of a matrix (M) and a vector (v). In R, the code might be
X[, ind] <- M * v
I have written a small C routine to do this for me, but the timing depends on how I define the storage.mode of the objects in R and the data types in C, in a way which I don't
2011 Sep 27
1
array extraction
hello everyone.
Look at the following R idiom:
a <- array(1:30,c(3,5,2))
M <- (matrix(1:15,c(3,5)) %% 4) < 2
a[M,] <- 0
Now, I think that "a[M,]" has an unambiguous meaning (to a human).
However, the last line doesn't work as desired, but I expected it
to...and it recently took me an indecent amount of time to debug an
analogous case. Just to be explicit, I would
2010 Jun 01
1
BreastCancer Dataset for Classification in kknn
Dear All,
I'm getting a error while trying to apply the BreastCancer dataset
(package=mlbench) to kknn (package=kknn) that I don't understand as I'm new
to R.
The codes are as follow:
rm = (list = ls())
library(mlbench)
data(BreastCancer)
library(kknn)
BCancer = na.omit(BreastCancer)
d = dim(BCancer)[1]
i1 = seq(1, d, 2)
i2 = seq(2, d, 2)
t1 = BCancer[i1, ]
t2 =
2009 Jun 10
2
How to get the unique pairs of a set of pairs dataframe ?
Hi friends,
Please can anyone help me with an easier solution of doing the below
mentioned work.
Suppose i have a dataset like this:---
i1 i2 i3 i4 i5
1 7 13 1 2
2 8 14 2 2
3 9 15 3 3
4 10 16 4 4
5 11 17 5 5
6 12 18 6 7
*i1,i2,i3,i4,i5 are my items.I am able to find all possible pairs i.e
Say this dataframe is "item_pairs"
**i1,i2
**i1,i3
**i1,i4
i1,i5
**i2,i1
2013 Jan 02
0
[LLVMdev] [DragonEgg] [Polly] Should we expect DragonEgg to produce identical LLVM IR for identical GIMPLE?
Hi Duncan & Tobi,
Thanks a lot for your interest, and for pointing out differences in GIMPLE
I missed.
Attached is simplified test case. Is it good?
Tobi, regarding runtime alias analysis: in KernelGen we already do it along
with runtime values substitution. For example:
<------------------ __kernelgen_main_loop_17: compile started
--------------------->
Integer args substituted:
2007 Dec 06
1
finding most highly transcribed genes - ranking, sorting and subsets?
Hello,
I am not only interested in finding out which genes are the most highly up-
or down-regulated (which I have done using the linear models and Bayesian
statistics in Limma), but I also want to know which genes are consistently
highly transcribed (ie. they have a high intensity in the channel of
interest eg. Cy5 or Cy3 across the set of experiments). I might have missed
a straight forward
2010 Jan 14
2
Fixed size permutations
I'm using functions to return a matrix of all permutations of a
specified size from a larger list for predictor selection.
For each predictor size I use a seperate function like this:
bag2 <- function(n) {
rl <- c()
for (i1 in seq(n)) {
for (i2 in seq(n)) {
if (length(unique(c(i1,i2)))==1) {next}
rl <- cbind(rl,matrix(c(i1,i2)))
}
}
2017 Sep 25
3
What should a truncating store do?
On 9/25/2017 9:14 AM, Björn Pettersson A wrote:
>
> (Not sure if this exactly maps to “truncating store”, but I think it
> at least touches some of the subjects discussed in this thread)
>
> Our out-of-tree-target need several patches to get things working
> correctly for us.
>
> We have introduced i24 and i40 types in ValueTypes/MachineValueTypes
> (in addition to
2017 Sep 25
0
What should a truncating store do?
(Not sure if this exactly maps to “truncating store”, but I think it at least touches some of the subjects discussed in this thread)
Our out-of-tree-target need several patches to get things working correctly for us.
We have introduced i24 and i40 types in ValueTypes/MachineValueTypes (in addition to the normal pow-of-2 types). And we have vectors of those (v2i40, v4i40).
And the byte size in our
2007 Dec 30
2
refering to variable names in lm where the variable name is in another variable
I am trying to refer to a variable name in a lm regression where the variable name is in another variable, but it does seem to work. Here is an example:
y<-rnorm(10)
dat<-data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10))
nam<-c('x1','x2','x3')
library(gtools)
com<-combinations(3,2,1:3)
mod<-lm(y~nam[com[1,1]],data=dat)
#error in model frame....:variable
2008 Dec 07
1
[LLVMdev] How to extract loop body into a new function?
False Alarm!!
Still don't know how to do it!
I am trying to write a transformation pass to extract a loop body into a function.
For example:
The Loop in question is:
for (i2 = 0; i2 < LOOP_SIZE; i2++) {
A[B[i2]] = 2 * B[i2];
}
The IR for which is:
bb13: ; preds = %bb13, %bb
%i2.0.reg2mem.0 = phi i32 [ 0, %bb ], [ %indvar.next62, %bb13 ] ; <i32>
2009 Jul 20
1
Regression function lm() not giving proper results
*
*
Hi ,
Can anyone help me please with this problem?*
*
*CASE-I*
all_raw_data_NAomitted is my data frame.It has columns with names i1 ,i2,
i3,i4…, till i15.It has 291 rows actually ,couldn’t show here.
The data frame looks like this:--
i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15
2 2 2 2 2 2 2 2 2 2 2 1 2 2 3 2
3 2 2 2 2 3 2 2 3 3
2003 Sep 25
1
apply on a 4D array
I am trying to multiply a 3D array of 4x4x4 by the 4 3D arrays of a 4D array
with dimensions 4x4x4x4 (the last dimension being the one that I want to
split by).
(4x4x4 array)
> hiaAry
, , a1
i1 i2 i3 i4
h1 9.5936098 6.001040 0.08772 0.3138600
h2 1.2003500 1.454570 2.79248 0.0000000
h3 0.1346500 0.201220 0.39256 0.5464000
h4 0.0109000 0.012270 0.16417 0.2766900
,
2006 Nov 21
1
lme4 model with no fixed effects?
Crossed random effects:
> lmer( y ~ (1 | i1) + (1|i2) ,data=dta)
Linear mixed-effects model fit by REML
Formula: y ~ (1 | i1) + (1 | i2)
Data: dta
AIC BIC logLik MLdeviance REMLdeviance
91.18 94.84 -42.59 85.2 85.18
Random effects:
Groups Name Variance Std.Dev.
i1 (Intercept) 0.068224 0.26120
i2 (Intercept) 0.463112
2010 Dec 31
4
Repeated Indexing / Sequence Operation
Hi Everyone,
quick question before the end of the year.
I have soem indices to select data from a bigger sample. I want to select n
days before each index and n days after the index. Any clever way to do it.
A for loop would do but I wanted to know if there is a moreR-friendly way to
approach this
Example
# InitialIndices
i2 = (90, 190, 290)
# Indices I want to end up with
i3 = c(85, 86, 87,
2010 Aug 03
2
How to name matrices from a list with lapply ?
Dear list,
I have a list of matrices :
i1 <- matrix(1:10, nrow = 2, ncol = 5)
i2 <- matrix(11:20, nrow = 2, ncol = 5)
j <- list(i1 = i1, i2 = i2)
I would like to attribute names to each dimension, for each matrix,
as follows :
$i1
B1 B2 B3 B4 B5
A1 1 3 5 7 9
A2 2 4 6 8 10
$i2
B1 B2 B3 B4 B5
A1 11 13 15 17 19
A2 12 14 16 18 20
However, I have to use lapply function and attribute
2008 May 08
1
Reading multiple tables from file
Dear R-users,
I have output files having a variable number of tables
in the following format:
-------------
1
Pietje
I1 I2 Value
1 1 0.11
1 2 0.12
2 1 0.21
2
Jantje
I1 I2 I3 Value
1 1 1 0.111
3 3 3 0.333
...
-------------
Would there be an easy way
of turning this into (a list of) data.frames
with names Pietje, Jantje
and variables I1,I2,...Value?
(I1,I2 are string or categorical,
2016 May 16
2
Determination of statements that contain only matrix multiplication
Hi Tobias,
could we use information about memory accesses of a SCoP statement and
def-use chains to determine statements, which don’t contain matrix
multiplication of the following form?
for (int i = 0; i < Upper Bound1; i++)
for (int j = 0; j < Upper Bound2; j++)
for (int k = 0; k < Upper Bound3; j++)
C[i][j] += A[i][k] * B[k][j]
We could probably check that memory access
2012 Jan 27
2
The following code (using rgamma) hangs
Hi,
I'm seeing something that may be a bug in R's standalone math library,
which is packaged by Debian as r-mathlib. I reported it to the Debian BTS
as http://bugs.debian.org/657573
I'm using Debian squeeze, and the code was tested with r-mathlib 2.11.1-6
(default on stable) and 2.14.1-1 (from testing/unstable).
I summarize this report below. The following code with the R math