Re: [R] Access only part of last dimension of table/matrix

2011-07-02 Thread Jim Lemon
On 07/02/2011 07:50 AM, David Winsemius wrote: I would like to do some operations inside a function using only one value for the last dimension of a table/matrix: tabfn - function (dfrm, facvec, YN =event){ return( Etbl - do.call(table, dfrm[ , c(facvec, event) ]) ) # just want Etbl[,,,TRUE]

[R] Plot error in package lme4

2011-07-02 Thread Sara Krause
Hi, I am new to R and not fantastic at statistics so it may well be that I am doing something silly but I can't figure out what it is and hoping that somebody can help. I am running package lme4, and trying to get a Residuals vs. Fitted graph. When I try to plot, I receive an error. Error in

Re: [R] Access only part of last dimension of table/matrix

2011-07-02 Thread peter dalgaard
On Jul 2, 2011, at 03:29 , Marc Schwartz wrote: It actually scared me that I had any recollection of an isolated post from 10 years ago. Not sure what to make of that... If it is any consolation, the author had forgotten it entirely -- Peter Dalgaard Center for Statistics, Copenhagen

Re: [R] Multilevel Survival Analysis - Cox PH Model

2011-07-02 Thread dunner
There is indeed right censoring, but I obviously didn't explain it very well. Patients are either fully oriented or not (1 or 2) after an hour. If they're not, then the data is right censored. However, I don't feel that coxme is overkill at all, as I may also have to account for repeated

Re: [R] Plot error in package lme4

2011-07-02 Thread Ben Bolker
Sara Krause skkrause at gmail.com writes: Hi, I am new to R and not fantastic at statistics so it may well be that I am doing something silly but I can't figure out what it is and hoping that somebody can help. I am running package lme4, and trying to get a Residuals vs. Fitted graph.

[R] The test of randomized slopes(intercepts)

2011-07-02 Thread 孟欣
Hi all: I perform the linear mixed model for 300 persons, y is CD4 count,x is time. I randomized slope and intercept,so I can get 300 slopes and 300 intercepts.Now I wanna test wheter the variance of 300 slopes and 300 intercepts differs from zero. If the variance of 300 slopes(or intercepts)

[R] Need help with my R- Project

2011-07-02 Thread akaebi
What happens to the correlation when i dichotomize the variables? ( i need a function for R) What happens if the correlation is always larger or smaller? What happens to the median? (also a function is needed) What happens if the distribution is not normal? I need point clouds! and last but

[R] Error when using plot in diag.panel argument of pairs

2011-07-02 Thread Patrick Großmann
 Dear Madame or Sir,I am having a problem in combining density-smoothed scatterplot matrices with a plot of kernel destiny estimations of each dimension plotted on the respective field of the diagonal.I have tried following approach using the package sm for the kernel density estimation, as

Re: [R] SNOW libraries/functions, rGenoud

2011-07-02 Thread Lui ##
Hello Uwe, thanks a lot! That solved the problem Have a nice weekend! Viele Grüße Lui 2011/7/1 Uwe Ligges lig...@statistik.tu-dortmund.de: See ?clusterEvalQ Uwe Ligges On 01.07.2011 16:11, Lui ## wrote: Dear group, does anybody know how to export libraries/functions to all nodes

[R] (no subject)

2011-07-02 Thread Shantal Bonnick
Hi, If i want to repeat a function, say 100 times, how do i do that? i used the for loop but there's an error somewhere. Thanks shan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] (no subject)

2011-07-02 Thread Ista Zahn
Please read the posting guide. there's an error somewhere is simply not enough to go on. Best, Ista On Sat, Jul 2, 2011 at 9:03 AM, Shantal Bonnick shanta...@yahoo.com wrote: Hi, If i want to repeat a function, say 100 times, how do i do that? i used the for loop but there's an error

Re: [R] (no subject)

2011-07-02 Thread Jeff Newmiller
Your question needs help. Seriously. A) No subject on the Subject line. This makes it difficult to keep track of the replies as the discussion proceeds. B) no example code. This makes it difficult to respond directly, since there is more than one way to use the for loop. C) No mention of the

Re: [R] Need help with my R- Project

2011-07-02 Thread Uwe Ligges
On 02.07.2011 13:59, akaebi wrote: What happens to the correlation when i dichotomize the variables? ( i need a function for R) What happens if the correlation is always larger or smaller? What happens to the median? (also a function is needed) What happens if the distribution is not normal?

Re: [R] Error when using plot in diag.panel argument of pairs

2011-07-02 Thread Uwe Ligges
If you send a better readable message with really reproducible code, we may provide a solution, this way it is really hard to read your code. And yes, please do not send html mail. My guess is that par(new=TRUE) will help, but I do not want to construct the examples at first. On 02.07.2011

Re: [R] Error when using plot in diag.panel argument of pairs

2011-07-02 Thread Uwe Ligges
OK, so let me make it reproducible and start with myTable - iris require(MASS) On 02.07.2011 17:09, Patrick Großmann wrote: Dear Mr. Ligges, my apologies! As I can see in your E-Mail the quote of mine is really just unreadable! Anyhow, this was not produced by me writing messy messages,

Re: [R] Access only part of last dimension of table/matrix

2011-07-02 Thread Marc Schwartz
On Jul 2, 2011, at 5:39 AM, peter dalgaard wrote: On Jul 2, 2011, at 03:29 , Marc Schwartz wrote: It actually scared me that I had any recollection of an isolated post from 10 years ago. Not sure what to make of that... If it is any consolation, the author had forgotten it entirely

Re: [R] For help in R coding

2011-07-02 Thread David Winsemius
On Jul 2, 2011, at 12:34 PM, Bansal, Vikas wrote: Dear all, I am doing a project on variant calling using R.I am working on pileup file.There are 10 columns in my data frame and I want to count the number of A,C,G and T in each row for column 9.example of column 9 is given below-

Re: [R] (no subject)

2011-07-02 Thread David Winsemius
On Jul 2, 2011, at 10:15 AM, Ista Zahn wrote: Please read the posting guide. there's an error somewhere is simply not enough to go on. True enough, but under the hypothesis that this might be some sort of simulation task, I would also suggest looking at: ?replicate Best, Ista On

[R] %dopar% parallel processing experiment

2011-07-02 Thread ivo welch
dear R experts--- I am experimenting with multicore processing, so far with pretty disappointing results. Here is my simple example: A - 10 randvalues - abs(rnorm(A)) minfn - function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] }  ## an arbitrary function ARGV -

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
Dear all, I am doing a project on variant calling using R.I am working on pileup file.There are 10 columns in my data frame and I want to count the number of A,C,G and T in each row for column 9.example of column 9 is given below- .a,g,, .t,t,, .,c,c,

Re: [R] Error when using plot in diag.panel argument of pairs

2011-07-02 Thread Patrick Großmann
Dear Mr. Ligges, my apologies! As I can see in your E-Mail the quote of mine is really just unreadable! Anyhow, this was not produced by me writing messy messages, this is due to the Java application behind the client not being able to cope with external tab-characters on my browser when

[R] comparing hazard ratios

2011-07-02 Thread Brian Tsai
hi, I'm looking for a package to compare two hazard ratios (and assign statistical significance) obtained from two different predictive models. I know of the hr.comp2 function from the survcomp package, but was wondering if there's any other packages out there. thanks! [[alternative

Re: [R] (no subject)

2011-07-02 Thread James Tripp
On 02/07/2011 14:03, Shantal Bonnick wrote: Hi, If i want to repeat a function, say 100 times, how do i do that? i used the for loop but there's an error somewhere. Thanks shan [[alternative HTML version deleted]] Hi Shan, Could you post the code you're using? Then we can figure

[R] Vector of functions

2011-07-02 Thread Thomas Stibor
Hi there, I have a vector of some functions e.g. #-# f.1 - function(a) { return( a ); } f.2 - function(a) { return( 1 - (tanh(a))^2 ); } f.3 - function(a) { return( 1 / (1+exp(-a)) * (1 - (1 / (1+exp(-a ); } func.l - c(f.1, f.2, f.3);

Re: [R] %dopar% parallel processing experiment

2011-07-02 Thread Uwe Ligges
On 02.07.2011 19:32, ivo welch wrote: dear R experts--- I am experimenting with multicore processing, so far with pretty disappointing results. Here is my simple example: A- 10 randvalues- abs(rnorm(A)) minfn- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } ## an arbitrary

Re: [R] Vector of functions

2011-07-02 Thread Joshua Wiley
Hi Thomas, On Sat, Jul 2, 2011 at 9:36 AM, Thomas Stibor thomas.sti...@in.tum.de wrote: Hi there, I have a vector of some functions e.g. #-# f.1 - function(a) {  return( a ); } f.2 - function(a) {  return( 1 - (tanh(a))^2 ); } f.3 - function(a) {  return( 1

Re: [R] %dopar% parallel processing experiment

2011-07-02 Thread ivo welch
thank you, uwe. this is a little disappointing. parallel processing for embarrassingly simple parallel operations--those needing no communication---should be feasible if the thread is not always created and released, but held. is there light-weight parallel processing that could facilitate

Re: [R] problem with corrgram function

2011-07-02 Thread Kevin Wright
This bug has been fixed. Kevin On Tue, Jun 28, 2011 at 6:11 AM, Niels Janssen njans...@ull.es wrote: Dear list, I have a problem with the corrgram function. It does not seem to color large negative correlations, while the same correlation, if positive, provides no problems. Is this a bug?

Re: [R] %dopar% parallel processing experiment

2011-07-02 Thread Uwe Ligges
On 02.07.2011 20:04, ivo welch wrote: thank you, uwe. this is a little disappointing. parallel processing for embarrassingly simple parallel operations--those needing no communication---should be feasible if the thread is not always created and released, but held. is there light-weight

[R] Speed Advice for R --- avoid data frames

2011-07-02 Thread ivo welch
This email is intended for R users that are not that familiar with R internals and are searching google about how to speed up R. Despite common misperception, R is not slow when it comes to iterative access. R is fast when it comes to matrices. R is very slow when it comes to iterative access

Re: [R] %dopar% parallel processing experiment

2011-07-02 Thread ivo welch
hi uwe--I did not know what snow was. from my 1 minute reading, it seems like a much more involved setup that is much more flexible after the setup cost has been incurred (specifically, allowing use of many machines). the attractiveness of the doMC/foreach framework is its simplicity of

Re: [R] %dopar% parallel processing experiment

2011-07-02 Thread Uwe Ligges
On 02.07.2011 20:42, ivo welch wrote: hi uwe--I did not know what snow was. from my 1 minute reading, it seems like a much more involved setup that is much more flexible after the setup cost has been incurred (specifically, allowing use of many machines). the attractiveness of the

Re: [R] Repeating a function in R

2011-07-02 Thread Daniel Malter
You can just tell the function to create 1000 random numbers. See ?runif for the specifics. The arguments are n, min, and max. 'n' is the one you are looking for. Da. -- View this message in context: http://r.789695.n4.nabble.com/Repeating-a-function-in-R-tp3640508p3640966.html Sent from the R

Re: [R] Repeating a function in R

2011-07-02 Thread Daniel Malter
If you want to repeat an entire function, use replicate as in replicate(15,sapply(1,function(x) runif(x))) Here, sapply(1,function(x) runif(x)) draws on uniformly distributed variable. replicate(15,...) is the wrapper function that tells to do this 15 times. The benefit here is that you can

Re: [R] Speed Advice for R --- avoid data frames

2011-07-02 Thread Uwe Ligges
Some comments: the comparison matrix rows vs. matrix columns is incorrect: Note that R has lazy evaluation, hence you construct your matrix in the timing for the rows and it is already constructed in the timing for the columns, hence you want to use: M - matrix( rnorm(C*R), nrow=R ) D -

Re: [R] Repeating a function in R

2011-07-02 Thread Uwe Ligges
On 02.07.2011 20:51, Daniel Malter wrote: You can just tell the function to create 1000 random numbers. See ?runif for the specifics. The arguments are n, min, and max. 'n' is the one you are looking for. Thanks for providing help on R-help, but for the future please - respond to the OP

Re: [R] For help in R coding

2011-07-02 Thread Dennis Murphy
Hi: There seems to be a problem if the string ends in , or . , which makes it difficult for strsplit() to pick up if it is splitting on those characters. Here is an alternative, splitting on individual characters and using charmatch() instead: charsum - function(s, char) { u - strsplit(s, )

Re: [R] Speed Advice for R --- avoid data frames

2011-07-02 Thread ivo welch
hi uwe---thanks for the clarification. of course, my example should always be done in vectorized form. I only used it to show how iterative access compares in the simplest possible fashion. 100 accesses per seconds is REALLY slow, though. I don't know R internals and the learning curve would

Re: [R] Vector of functions

2011-07-02 Thread Dennis Murphy
Hi, To amplify on Josh's cogent remarks, the reason you can't create a vector of functions is because vectors are composed of atomic objects and functions are not atomic objects: is.atomic(f.3) [1] FALSE is.atomic(1) [1] TRUE is.atomic(TRUE) [1] TRUE is.atomic('a') [1] TRUE 'Vectors' of

Re: [R] For help in R coding

2011-07-02 Thread David Winsemius
On reflection and a bit of testing I think the best approach would be to use gregexpr. For counting the number of commas, this appears quite straightforward. sapply(gregexpr(\\,, txtvec), function(x) if ( x[[1]] != -1) length(x) else 0 ) [1] 3 3 3 4 3 3 2 6 4 6 6 It easily generalizes

Re: [R] %dopar% parallel processing experiment

2011-07-02 Thread Steve Lianoglou
Here's another datapoint using the multicore package -- which is what the foreach/doMC combo uses internally: I halved your A value to 50,000 because I was getting impatient :-) A=5 randvalues - abs(rnorm(A)) minfn - function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } system.time(a1 -

Re: [R] 2D Random walk

2011-07-02 Thread jim holtman
This should work. You have to return an object from a function; you can not try to reference an object within a function. So the value is returned and saved in an object called 'rw' since that is how you are referening it. walk.2d-function(n) { rw - matrix(0, ncol = 2, nrow = n) # generate

Re: [R] For help in R coding

2011-07-02 Thread David Winsemius
On Jul 2, 2011, at 4:46 PM, Bansal, Vikas wrote: DEAR ALL, I TRIED THIS CODE AND THIS IS RUNNING PERFECTLY... df=read.table(Case2.pileup,fill=T,sep=\t,colClasses = character) txt=df[,9] txtvec - readLines(textConnection(txt)) dad=data.frame(A = unlist(sapply(gregexpr(A|a, txtvec),

[R] How many times occurs

2011-07-02 Thread Trying To learn again
Hi all, I have a data matrix likein input.txt 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 5 6 4 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 9 2 2 In this example will be an 6x10 matrix (or data frame) I want to detect how many times in a row appears this combination 8

[R] Hint improve my code

2011-07-02 Thread EdBo
Hi I have developed the code below. I am worried that the parameters I want to be estimated are not being found when I ran my code. Is there a way I can code them so that R recognize that they should be estimated. This is the error I am getting. out1=optim(llik,par=start.par) Error in

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London From: David Winsemius [dwinsem...@comcast.net] Sent: Saturday, July 02, 2011 6:19 PM To: Bansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 2,

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
HI THIS SEEMS LITTLE BIT CONFUSING.BUT I AM USING THIS CODING AS SUGGESTED BY YOU- df=read.table(Case2.pileup,fill=T,sep=\t,colClasses = character) txt=df[,9] txtvec - readLines(textConnection(txt)) vik=data.frame(A = unlist(lapply( lapply( sapply(txtvec, strsplit, split=a|A), length) , -,

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
DEAR ALL, I TRIED THIS CODE AND THIS IS RUNNING PERFECTLY... df=read.table(Case2.pileup,fill=T,sep=\t,colClasses = character) txt=df[,9] txtvec - readLines(textConnection(txt)) dad=data.frame(A = unlist(sapply(gregexpr(A|a, txtvec), function(x) if ( x[[1]] != -1) length(x) else 0 )), C =

[R] R for Windows - 5 stars award on Windows 7 Download

2011-07-02 Thread Windows 7 Download
Dear R Development Core Team We are more than happy that Windows 7 was launched after long restless period of waiting. Due to this expected moment, we prepared and launched new Windows 7 download website that will be used by new Windows 7 customers to look for software compatible with Windows

[R] Simulating inhomogeneous Poisson process without loop

2011-07-02 Thread Tristan Linke
Dear all I want to simulate a stochastic jump variance process where N is Bernoulli with intensity lambda0 + lambda1*Vt. lambda0 is constant and lambda1 can be interpreted as a regression coefficient on the current variance level Vt. J is a scaling factor How can I rewrite this avoiding the loop

[R] Error with package xlsx

2011-07-02 Thread Sergio Mira
Hi, Could anyone help me with this error? I have no idea what that is about... file - system.file(DADOSCASUMCCORMICK.xlsx, package = xlsx) ­ data - read.xlsx(file, 1) Error in .jnew(java/io/FileInputStream, file) : java.io.FileNotFoundException: (No such file or directory) Thanks! --

Re: [R] Hint improve my code

2011-07-02 Thread Berend Hasselman
EdBo wrote: Hi I have developed the code below. I am worried that the parameters I want to be estimated are not being found when I ran my code. Is there a way I can code them so that R recognize that they should be estimated. This is the error I am getting.

Re: [R] Hint improve my code

2011-07-02 Thread Joshua Wiley
Hi Edward, One hint to improve your code is simply stylistic. Everyone tends to have their own favorite way, but adding spaces and line breaks can help make code much easier to read. Also, you seemed to have used brackets [ instead of parentheses ( for the first two calls to sum(). As Berend