search for: cberry

Displaying 20 results from an estimated 565 matches for "cberry".

2009 Oct 13
7
lapply() reccursively
Hi all, I was wondering whether it is possible to use the lapply() function to alter the value of the input, something in the spirit of : a1<-runif(100) a2<-function(i){ a1[i]<-a1[i-1]*a1[i];a1[i] } a3<-lapply(2:100,a2) Something akin to a for() loop, but using the lapply() infrastructure. I haven't been able to get rapply() to do this. The reason is that the "real"
2006 Dec 10
4
sample "n" random positions from a matrix
Hi there, I have a binary matrix (dim 100x100) filled with values 0 and 1. I need select a record "n" positions of that matrix when values are 1. How can I do that? Thanks for all, Miltinho Brazil --------------------------------- [[alternative HTML version deleted]]
2019 Jun 07
2
[R] Open a file which name contains a tilde
...in R-help, https://www.mail-archive.com/r-help at r-project.org/msg254116.html path.expand seems to expand tildes beginning whitespace separated strings that could be filenames, but not other tildes. Thus, > path.expand("~/.newsrc ~/.R/*") # expands both tildes [1] "/Users/cberry/.newsrc /Users/cberry/.R/*" > path.expand("~/.newsrc~/.R/*") # expands only the first [1] "/Users/cberry/.newsrc~/.R/*" > This could be a feature if what one wanted was to pass the result to a system command that will process multiple file arguments, e.g. > s...
2010 Jul 07
3
How do I test against a simple null that two regressions coefficients are equal?
Hi there, I run two regressions: y = a1 + b1 * x + e1 y = a2 + b2 * z + e2 I want to test against the null hypothesis: b1 = b2. How do I design the test? I think I can add two equations together and divide both sides by 2: y = 0.5*(a1+a2) + 0.5*b1 * x + 0.5*b2 * z + e3, where e3 = 0.5*(e1 + e2). or just y = a3 + 0.5*b1 * x + 0.5*b2 * z + e3 If I run this new regression, I can test against
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
...58 50 9 49.8 (200,201] 0 0 6 49.8 (201,Inf] 0 0 8042 0.0 > > > > > sessionInfo() R Under development (unstable) (2019-03-02 r76189) Platform: x86_64-apple-darwin18.2.0 (64-bit) Running under: macOS Mojave 10.14.3 Matrix products: default BLAS: /Users/cberry/projects/R/R-devel/lib/libRblas.dylib LAPACK: /Users/cberry/projects/R/R-devel/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (...
2001 Nov 29
1
rug(x) clip warning incorrect if par("xlog")==TRUE (PR#1188)
...wit: > plot(1:2,1:2,log="x") > rug(1:2) # should not warn Warning message: some values will be clipped in: rug(1:2) > plot(1:2,1:2,log="x") > rug(c(0,.1,.2)) # should warn, but does not > I believe this fixes the problem: % diff -c /tmp/orig.rug.R /tmp/cberry.rug.R *** /tmp/orig.rug.R Thu Nov 29 12:59:00 2001 --- /tmp/cberry.rug.R Thu Nov 29 12:57:50 2001 *************** *** 11,19 **** on.exit(par(oldcol), add = TRUE) } usr <- par("usr") ! usr <- if (side%%2 == 1) ! usr[1:2] ! else usr[3:4] if (any(x < usr[...
2010 Nov 27
1
Bug in parseNamespaceFile or switch( , ... ) ?
...p.s. > sessionInfo() R version 2.12.0 (2010-10-15) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] C attached base packages: [1] stats graphics grDevices utils datasets methods base > Charles C. Berry Dept of Family/Preventive Medicine cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
2011 Dec 21
4
qqnorm & huge datasets
Hi, When qqnorm on a vector of length 10M+ I get a huge pdf file which cannot be loaded by acroread or evince. Any suggestions? (apart from sampling the data). Thanks. -- Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000 http://mideasttruth.com http://honestreporting.com http://camera.org http://openvotingconsortium.org http://pmw.org.il
2011 Jan 24
2
Help with expression
I have a problem with expressions. I am trying to create a title where the parameter of interest is displayed as a Greek character. Which parameter is being considered is stored in a character variable. As an example, if I have param <- "alpha" and then do plot(0, 0, main = bquote(Parameter==.(param))) then in the title I get "Parameter = alpha", whereas I want the
2019 Jun 05
6
Open a file which name contains a tilde
Hi, As I can see via path.expand a filename which contains a tilde anywhere gets automatically crippled. +> path.expand("a ~ b") [1] "a /home/user b" +> path.expand("a ~ b ~") [1] "a /home/user b /home/user" I want to open a file regardless whether its name contains any character unless 0. The unix filesystem allow the creation of such files, it
2019 Jun 05
6
Open a file which name contains a tilde
Hi, As I can see via path.expand a filename which contains a tilde anywhere gets automatically crippled. +> path.expand("a ~ b") [1] "a /home/user b" +> path.expand("a ~ b ~") [1] "a /home/user b /home/user" I want to open a file regardless whether its name contains any character unless 0. The unix filesystem allow the creation of such files, it
2008 May 27
4
help with simple function
I have a matrix of frequency counts from 0-160. x<-as.matrix(c(0,1,0,0,1,0,0,0,1,0,0,0,0,1)) I would like to apply a function creating a new column (x[,2])containing values equal to: a) log(x[m,1]) if x[m,1] > 0; and b) for all x[m,1]= 0, log(next x[m,1] > 0 / count of preceding zero values +1) for example, x[1,2] should equal log(x[2,1]/2) = log(1/2) = -0.6931472 whereas x[3,2] should
2008 Dec 11
3
check if a certain ... argument has been passed on to my user-defined function
Hi, How can I check if a certain ... argument has been passed on to my user-defined function or not? foo <- function(data, ...) { ### here I want to check whether xlab was passed with the ... arguments ### or if the ... arguments did not contain an xlab argument } I tried missing(xlab) , exists(xlab) and several other things but did not find a solution. TIA, Mark
2008 Dec 09
2
Better way to find distances between points in a set?
I was playing around a bit to see how I could find the two points in a set of points (or ordered pairs) furthest from each other. Here's what I did: 1) created a Nrow by 2col matrix, so each row contains an x,y coordinate pair. 2) fed the matrix to a nested mapply (cv is my matrix): mapply(function(k,l) mapply(function(x,y,a,b) +
2007 Feb 22
4
Crosstabbing multiple response data
Using R version 2.4.1 (2006-12-18) on Windows, I have a dataset which resembles this: id att1 att2 att3 1 1 1 0 2 1 0 0 3 0 1 1 4 1 1 1 ratings <- data.frame(id = c(1,2,3,4), att1 = c(1,1,0,1), att2 = c(1,0,0,1), att3 = c(0,1,1,1)) I would like to get a cross tab of counts of co-ocurrence, which might resemble this:
2008 Jan 23
4
image question
Hi, I have a question regarding the image function. Is there a way to specify a separate color set for each column in the matrix? TIA, ajar. [[alternative HTML version deleted]]
2006 Dec 31
4
Does SQL group by have a heavy duty equivalent in R
I have hundreds of humans who have undergone SNP genotyping at hundreds of loci. Some have even undergone the procedure twice or thrice (kind of an internal control). So obviously I need to find those replications, and confirm that the results are the same. If there is discordance then I need to address it. I tried to use the aggregate function nr.attempts
2008 Oct 30
3
why does sample(x, n) give the same n items in every separate runs?
Hello R users, I have gene expression data of two groups of genes (large and small). Gene expression intensities of those genes are classified into 1 to 10 levels. What I want is to make a random set of genes that have the same levels as the small group from large group using sample(). I used smallvec to hold the number of genes in each levels (1 to 10) for small group, largevec for large group.
2005 Oct 20
2
md5sum for R-2.2.0-win32.exe ??
...fd *rw2011.exe on several USA mirrors. I hope the latter is merely in need of a replacement and not an indication of a problem with the web sites. Chuck Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717
2005 Oct 26
1
unexpected '[<-.data.frame' result
...ot;z" ]][ 2:5 ] <- letters[2:5] > a.frame x y z 1 a b <NA> 2 b c b 3 c d c 4 d e d 5 e <NA> e Chuck Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717