Re: [R] Alternating between for loops

2012-08-01 Thread Mercier Eloi
...@comcast.net wrote: Claudia; The loop constructs will keep you mired in SAS-brain inefficiencies forever. Please, listen more carefully to Mercier. -- David On Jul 31, 2012, at 3:54 PM, Mercier Eloi wrote: On 12-07-31 02:38 PM, Claudia Penaloza wrote

Re: [R] plotting 0,1 data

2012-08-01 Thread Mercier Eloi
Plz provide a reproducible example (using dput). Anyway, I suspect your data to be 'factor' and not numeric. y=rbinom(100,1,0.5) x=runif(100) plot(x,y) #OK plot(x,as.factor(y)) See ?factor and ?as.numeric. Regards, Eloi On 12-08-01 11:41 AM, Georgiana May wrote: Hello, Anyone know why the

Re: [R] Alternating between for loops

2012-07-31 Thread Mercier Eloi
{y[,j]=B} } if you really wants to use this code. Cheers, Eloi Cheers, Claudia On Mon, Jul 30, 2012 at 5:38 PM, Mercier Eloi emerc...@chibi.ubc.ca mailto:emerc...@chibi.ubc.ca wrote: Or, assuming you only have 4 different elements : mat- matrix(rep(c(1,2,A, B),each=10),10,10

Re: [R] Alternating between for loops

2012-07-30 Thread Mercier Eloi
Or, assuming you only have 4 different elements : mat- matrix(rep(c(1,2,A, B),each=10),10,10, byrow=F) mat2 - as.data.frame(mat) mat [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 2 A B 1 2 A B 1 2 [2,] 1 2 A B 1 2 A B 1 2 [3,] 1 2 A B 1 2 A B 1 2

Re: [R] help with merging 2 data frames

2012-07-11 Thread Mercier Eloi
This should do the trick : colnames(y)[1:2]=c(a,a) y2=rbind(y[,-1], y[,-2]) #duplicating the y matrix so the identifiers are only in 1 column merged = merge(x,y2) merged a b d e1 e2 1 aa 1 10 100 101 2 aa 2 20 200 201 3 ab 1 30 100 101 4 ab 2 40 200 201 5 ba 1 50 300 301 6 ba 2 60 400

Re: [R] New Eyes Needed to See Syntax Error

2012-05-17 Thread Mercier Eloi
On 12-05-17 04:34 PM, Rich Shepard wrote: hco32 - qqmath(~ log10(HCO3 | factor(basin), data = surfchem.cast, main = 'Bicarbonate (Log10)', prepanel = prepanel.qqmathline, panel = function(x, ...) { panel.qqmathline(x, ...) panel.qqmath(x, ...) }) Missing a closing parenthesis

Re: [R] Unexpected input while building package in R

2012-05-08 Thread Mercier Eloi
You did not specify any object in the function. Thus R is building the package test with all the objects present in your session when you are calling the package.skeleton function. I suppose that one of these objects is causing problem. I suggest you list all the variables/function necessary

Re: [R] Matrix BYTES size

2012-05-07 Thread Mercier Eloi
See ?sparseMatrix from package Matrix. Eloi On 12-05-07 02:23 PM, Lucas wrote: Dear R people. I´m facing a big problem. I need to create a matrix with 10.000 columns and 750.000 rows. matrix- as.data.frame(matrix(data=0L, nrow=75, ncol=1) as you can see, the data frame has huge

Re: [R] How to replace NA with zero (0)

2012-05-03 Thread Mercier Eloi
Hello, When i generate data with the code below there appear NA as part of the generated data, i prefer to have zero (0) instead of NA on my data. Is there a command i can issue to replace the NA with zero (0) even if it is after generating the data? Thank you ?Surv time2: ending time of

Re: [R] Generate Dendrogram

2012-04-30 Thread Mercier Eloi
hc.obj is not a dendrogram. plot(dend1, xlab='',ylab='',sub='', nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8)) See ?plot.hclust and ?plot.dendrogram. They are not using the same arguments. Regards, Eloi On 12-04-30 06:36 AM, farscape2012 wrote: Hi I have a distance matrix which

Re: [R] Use quotes on a FOR LOOP R

2012-04-24 Thread Mercier Eloi
for (n in LIST2) print(as.character(n)) [1] Michael [1] Dana [1] Rob Eloi On 12-04-24 12:22 PM, R. Michael Weylandt wrote: Don't you just want LIST- as.data.frame(LIST, stringsAsFactors = FALSE) # Avoid making factors for(n in LIST) print(n) But I can't understand why you want to do it this

Re: [R] Sending lists from R to C using .C

2012-04-16 Thread Mercier Eloi
Hi Chris, I personally found the documentation rather...indigestible. At least 3 years ago when I developed my R package. It seems they have nicely improved this part of the documentation though. I'm not an expert at all, but at least you will have the point of view of a beginner. First,