Displaying 20 results from an estimated 1000 matches similar to: "Speeding up resampling of rows from a large matrix"
2006 Jul 31
2
math symbols and text with mtext()
Dear R users,
Two questions:
1) Is there a way to simplify the mtext() line below ?
beta=c(1,-1)
m=5
plot(1)
mtext( bquote(paste( beta == .(paste( "(", paste(beta, collapse=", "), ")" )) )), outer=TRUE,line=-3)
2) How do I get the embedded carriage return "\n" below to work, i.e for the text that follows it to appear on the next line?
beta=c(1,-1)
m=5
2006 Sep 13
2
Retrieving value computed in inner function call
Dear R users,
Consider the following example function:
f = function(a,b) {
g = function(x) a*x + b
h = function(x) g(x)^2 + x^2
opt = optimize(h,lower = -1, upper = 1)
x.min = opt$minimum
h.xmin = opt$objective
g.xmin = g(x.min)
return(c(x.min, h.xmin, g.xmin))
}
In my real problem the function that plays the role of "g" is costly
to compute. Now, to
2010 May 20
1
ERROR: cannot allocate vector of size?
I've looked through all of the posts about this issue (and there are
plenty!) but I am still unable to solve the error. ERROR: cannot allocate
vector of size 455 Mb
I am using R 2.6.2 - x86_64 on a Linux x86_64 Redhat cluster system. When I
log in, based on the specs I provide [qsub -I -X -l arch=x86_64] I am
randomly assigned to a x86_64 node.
I am using package GenABEL. My data (~ 650,000
2006 Jun 05
3
Fastest way to do HWE.exact test on 100K SNP data?
Hi everyone,
I'm using the function 'HWE.exact' of 'genetics' package to compute p-values of
the HWE test. My data set consists of ~600 subjects (cases and controls) typed
at ~ 10K SNP markers; the test is applied separately to cases and controls. The
genotypes are stored in a list of 'genotype' objects, all.geno, and p-values are
calculated inside the loop over all
2007 Jun 19
3
Controlling text and strip arrangement in xyplot
I've searched the archives and read the xyplot help but can't figure
out the 2 lattice questions below?
Consider:
library(lattice)
DF <- data.frame(x=rnorm(20), y=rnorm(20), g1=rep(letters[1:2], 10),
g2=rep(LETTERS[1:2], each=10),
g3=rep(rep(letters[3:4],each=5),2))
xyplot(y ~ x | g1 + g2, groups=g3, data=DF)
1) Is there a way to get one strip per row and column
2011 Feb 03
1
bug in codetools/R CMD check?
Hi Mr Tierney,
I have noticed an error message from R 1.12.x's CMD check for a while (apparently prof Ripley completely rewrote CMD check in R 1.12+)
e.g.:
http://bioconductor.org/checkResults/2.7/bioc-LATEST/snpMatrix/lamb2-checksrc.html
----------------
* checking R code for possible problems ... NOTE
Warning: non-unique value when setting 'row.names': ?new?
Error in
2012 Aug 24
0
A question about GRAMMAR calculations in the FAM_MDR algorithm
Dear R developers:
I am a PHD candidate student in the school of public health of Peking
University and my major is genetic epidemiology. I am learning the FAM-MDR
algorithm, which is used to detect the gene-gene and gene-environment
interactions in the data of pedigree. The codes were written by Tom
Cattaert of the University of Liege. The algorithms and the sample datasets
are available at
2007 Oct 18
2
image quality of plot inserted into PowerPoint
Dear R-helpers,
I need to insert an R (2.6.0) generated plot containing semi-transparent colors into PowerPoint (2002). When I directly paste it from the clipboard or insert it as (enhanced) Metafile (I'm on Windows XP) the semi-transparent colors don't show. When I insert it at as a Bmp, Png or Jpeg and then convert to PDF the semitransparent colors do show but the quality of the image
2007 Apr 17
2
Use of argument '...'
Dear R list,
I've read the function writing sections on both "An introduction to R" and "R language Definition" manuals but still don't understand why the following gives an error message:
fun <- function(x, ...) x + y
fun(1, y=2)
I get:
Error in fun(1, y = 2) : object "y" not found
I'd appreciate any help in understanding this.
R version 2.4.1
2006 Jun 23
1
numeric variables converted to character when recoding missing values
Dear R helpers,
I have a data frame where missing values for numeric variables are coded as
999. I want to recode those as NAs. The following only partially succeeds
because numeric variables are converted to character in the process:
df <- data.frame(a=c(999,1,999,2), b=LETTERS[1:4])
is.na(df[2,1]) <- TRUE
df
a b
1 999 A
2 NA B
3 999 C
4 2 D
is.numeric(df$a)
[1] TRUE
2006 May 02
4
Repeating tdt function on thousands of variables
I am using dgc.genetics to perform TDT analysis on SNP data from a cohort of
trios.
I now have a file with about 6008 variables. The first few variables related
to the pedigree data such as the pedigree ID the person ID etc. Thereafter
each variable is a specific locus or marker. The variables are named by a
pattern such as "Genotype.nnnnn" with nnnnn corresponding to a number which
2009 Jan 08
1
cosinor analysis
Hallo,
I didnĀ“t found any facilities for Halbergs cosinor analysis in R. This analysis is well known in the Chronobiology as the least square approximation of time series using cosine function of known period (in my case of 24hours-period). I tried to write a script but crashed...
Can you give me some advices, please!?
Thanks
Anne Berger
Institute of Zoo- and Wildlife Research, Berlin, Germany
2005 Jul 21
3
vectorising ifelse()
Hi All,
is there any chance of vectorising the two ifelse() statements in the
following code:
for(i in gp){
new[i,1] = ifelse(srow[i]>0, new[srow[i],zippo[i]], sample(1:100, 1,
prob =Y1, rep = T))
new[i,2] = ifelse(drow[i]>0, new[drow[i]>0,zappo[i]], sample(1:100,
1, prob =Y1, rep = T))
}
Where I am forced to check if the value of drow and srow are >0 for each
line... in
2009 Jan 22
1
infer haplotypes phasing trios tdthap
Dear R mailing list,
I have a dataset with genotypes from trios and I would like to infer
haplotypes for each mother, father and child. The package that I could
find that can do this is tdthap.
But when the mother is homozygous (e.g., 2/2) the haplotype is called as
not possible to infer (0); I would prefer for it to call the genotype
(2). From what I understand it is doing what I would like
2008 Apr 11
1
EM algorithm for multiple-locus haplotypes frequencies
Hi all,
I've been looking in R for an EM algorithm adjusted for multiple-locus
haplotypes frequencies, but failed in 100%. Has anyone heard of
anything of this kind in R?
Thanks in advance,
Marcin
2004 Nov 23
2
IFELSE across large array?
Dear all,
As our previous email did not get any response, we try again with a
reformulated question!
We are trying to do something which needs an efficient loop over a huge
array, possibly functions such as apply and related (tapply,
lapply...?), but can't really understand syntax and examples in
practice...i.e. cant' make it work.
to be more specific:
we are trying to apply a mask
2011 Aug 26
1
matrix bands
Dear R developers,
I was looking for a function analogous to base::diag() for getting and
setting bands of a matrix. The closest I could find was Matrix::band(),
but this was not exactly what I wanted for two reasons. Firstly,
Matrix::band() returns a matrix rather than just the specified band.
Secondly, Matrix::band() cannot be used for setting the values for a
matrix band.
Setting or
2011 Apr 27
6
Assignments inside lapply
Dear all I would like to ask you if an assignment can be done inside a lapply statement.
For example
I would like to covert a double nested for loop
for (i in c(1:dimx)){
for (j in c(1:dimy)){
Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f)
}
}
to something like that:
ij<-expand.grid(i=seq(1:dimx),j=(1:dimy))
unlist(lapply(1:nrow(ij),function(rowId) { return
2009 Oct 27
1
Rjava, RImageJ, and/or S4 question.
I am out of my league with this question. The following code starts the java imaging program ImageJ from within R, and displays an image (assuming ImageJ is installed on your computer).
library(RImageJ)
img <- IJ$openImage( file.choose() ) #pick an available .tif file
img$show() # make the image object visible
# An image is now displayed
# find out about the objects involved
>
2009 Oct 17
2
Recommendation on a probability textbook (conditional probability)
I need to refresh my memory on Probability Theory, especially on
conditional probability. In particular, I want to solve the following
two problems. Can somebody point me some good books on Probability
Theory? Thank you!
1. Z=X+Y, where X and Y are independent random variables and their
distributions are known.
Now, I want to compute E(X | Z = z).
2.Suppose that I have $I \times J$ random number