Re: [R] data.frame transformation

2011-03-14 Thread andrija djurovic
Thank you Bill for this additional solution. Andrija On Tue, Mar 15, 2011 at 12:16 AM, wrote: > It is possible to do it with numeric comparisons, as well, but to make life > comfortable you need to turn off the warning system temporarily. > > df <- data.frame(q1 = c(0,0,33.33,"check"), >

[R] sample size of 2 groups of skewed data

2011-03-14 Thread Lao Meng
Hi all: I have a question on sample size calculation of 2 groups of data. If 2 groups of data are all normal distribution, then I can use the function "n.indep.t.test.eq" from samplesize package.But if 2 groups of data are all skewed distribution, but not normal distribution,how can I calculate the

Re: [R] Serial Date

2011-03-14 Thread Raoni Rosa Rodrigues
Hello Mr. Allan and Mr. David! Thanks very much for your time and lessons. Works pretty well, Mr. Allan, specially after Mr. David explanation (and the 2 days-bug correction). Just a curious behavior of data tranformation: the R-transformation date was 2min and 20s late compared with excel 20

Re: [R] Finding the name "vector"

2011-03-14 Thread Joshua Wiley
Hi Laura, ?is.vector > is.vector(1:10) [1] TRUE > is.vector(matrix(1:10)) [1] FALSE Cheers, Josh On Mon, Mar 14, 2011 at 9:58 PM, Laura Smith wrote: > Hello: > > Here are some basic class items: > >> x <- 1:10 >> class(x) > [1] "integer" >> x.mat <- matrix(1:6,nrow=2) >> class(x.mat) > [1] "

[R] Finding the name "vector"

2011-03-14 Thread Laura Smith
Hello: Here are some basic class items: > x <- 1:10 > class(x) [1] "integer" > x.mat <- matrix(1:6,nrow=2) > class(x.mat) [1] "matrix" > class(x>3) [1] "logical" > test <- function() { plot(1:10) } > class(test) [1] "function" > Is there something that says "vector", please? Or does it go to nu

Re: [R] recursive do.call

2011-03-14 Thread Jeroen Ooms
I see what you are saying. The application I am working with is making convenient single-call (user) interfaces for R functions, and I don't want to write a wrapper for every possible combination (like Gene suggested below). If we don't consider the ... arguments for a second, and only consider fir

Re: [R] how to reshape the data.frame from long to wide in a specific order

2011-03-14 Thread Gabor Grothendieck
On Mon, Mar 14, 2011 at 9:06 PM, zhenjiang xu wrote: > Hi, > > For example, the data.frame like: > > origdata.long <- read.table(header=T, con <- textConnection(' >  subject sex condition measurement >       1   M   control         7.9 >       1   M     first        12.3 >       1   M    second  

Re: [R] how to reshape the data.frame from long to wide in a specific order

2011-03-14 Thread Jeff Newmiller
I just fix it afterward: dta <- dta[,c("col1","col2","col3")] --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. wi

Re: [R] how to reshape the data.frame from long to wide in a specific order

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 10:24 PM, Henrique Dallazuanna wrote: Try this: reshape(origdata.long, direction = 'wide', timevar = 'condition', idvar = c('subject', 'sex')) If you first set the order in the desired sequence: origdata.long$condition <- factor(origdata.long$condition, levels=c('fi

Re: [R] how to reshape the data.frame from long to wide in a specific order

2011-03-14 Thread Henrique Dallazuanna
Try this: reshape(origdata.long, direction = 'wide', timevar = 'condition', idvar = c('subject', 'sex')) On Mon, Mar 14, 2011 at 10:06 PM, zhenjiang xu wrote: > Hi, > > For example, the data.frame like: > > origdata.long <- read.table(header=T, con <- textConnection(' > subject sex condition me

Re: [R] how to reshape the data.frame from long to wide in a specific order

2011-03-14 Thread Dennis Murphy
Hi: This is straightforward with the reshape package: library(reshape) origdata.long$condition <- factor(origdata.long$condition, levels = c('first', 'second', 'control')) cast(origdata.long, subject + sex ~ condition) Using measurement as value column. Use the value argument to cast to ove

Re: [R] switch and factors

2011-03-14 Thread baptiste auguie
Hi, It is indeed documented but I'd misinterpreted it, my mistake. I made the wrong assumption that switch would have a factor method which would use the string levels, but that just isn't the case. Thanks for the clarification anyway, baptiste On 14 March 2011 22:22, Allan Engelhardt wrote: >

Re: [R] File > Save As...

2011-03-14 Thread Duncan Murdoch
On 11-03-14 8:12 PM, Gene Leynes wrote: Yes, I understand. Normally I use Eclipse, which does what I want for "save as..." The bigger issue is that R can't tell the location of an open script, which makes it harder to create new versions of existing work But it can. If you open a script

[R] how to reshape the data.frame from long to wide in a specific order

2011-03-14 Thread zhenjiang xu
Hi, For example, the data.frame like: origdata.long <- read.table(header=T, con <- textConnection(' subject sex condition measurement 1 M control 7.9 1 M first12.3 1 Msecond10.7 2 F control 6.3 2 F first

Re: [R] File > Save As...

2011-03-14 Thread Jeff Newmiller
My preferred cycle with RGui is: 1) Open RGui 2) Save (empty) workspace in the new working directory 3) Quit RGui 4) Double-click on the saved workspace. This opens RGui and sets the working directory. 5) Open Notepad++ and edit as desired 6) Select code to run 7) Press F8 I have also been playi

Re: [R] File > Save As...

2011-03-14 Thread Gene Leynes
Yes, I understand. Normally I use Eclipse, which does what I want for "save as..." The bigger issue is that R can't tell the location of an open script, which makes it harder to create new versions of existing work Say you have some great analysis going in "Research 2011-01-01" with a folder

Re: [R] color under lm line

2011-03-14 Thread Marlin Keith Cox
Thank you, but I need only the area under the llm colored. What if there were two lm lines? Is it possible to color only between them. I have search and found shaded polygons, but not shades that incorporate lm lines. Here is the updated data example. The color on this follows both the lm and

Re: [R] File > Save As...

2011-03-14 Thread Duncan Murdoch
On 11-03-14 5:03 PM, Gene Leynes wrote: As much as I love R, there are still the occasional shortcomings. I would love to find a solution to the "save as..." problem. Steps to reproduce the problem: 1. Open any version of he R GUI in Windows 2. Choose "File> Open" from the menu 3.

Re: [R] read.xls can't read some .xls files

2011-03-14 Thread Carl Witthoft
First off, pardon the simple question, but is the XXX.xls file in your current working directory? The error message might suggest that R (or more precisely, the perl script) never saw the input file. Have you been able to load any other Excel file into R? My only other guess is that for som

Re: [R] color under lm line

2011-03-14 Thread Dennis Murphy
Hi: Try this: co <- coef(llm) bord <- pmin(y, co[1] + co[2] * x) plot(x,y) polygon(c(x, x[length(x)]), c(bord, bord[1]), col = 'red') abline(co) HTH, Dennis On Mon, Mar 14, 2011 at 4:02 PM, Marlin Keith Cox wrote: > Hi, > I would like to add a color under a lm line and not the plotted line. I

Re: [R] data.frame transformation

2011-03-14 Thread Bill.Venables
It is possible to do it with numeric comparisons, as well, but to make life comfortable you need to turn off the warning system temporarily. df <- data.frame(q1 = c(0,0,33.33,"check"), q2 = c(0,33.33,"check",9.156), q3 = c("check","check",25,100),

[R] color under lm line

2011-03-14 Thread Marlin Keith Cox
Hi, I would like to add a color under a lm line and not the plotted line. Is this possible? In the example, I do not want the area under the curve red, but rather under the llm line. x=seq(0,5,len=100) y=-(x-5)^2 llm<-lm(y~x) plot(x,y) polygon(c(x,x[length(x)]), c(y, y[1]), col='red') abline(ll

Re: [R] hclust() memory issue

2011-03-14 Thread Thomas Lumley
The nnclust package will compute the minimum spanning tree, from which you can extract hierarchical single-linkage clustering. For N randomly-ordered observations it uses only NlogN memory, and takes N^2 time in high dimensions (30 is high) but only NlogN in low dimensions. -thomas On Tue,

Re: [R] hclust() memory issue

2011-03-14 Thread array chip
Scott, thanks for the suggestion. I have already filtered genes from more than 3. Probably I should filter more. I will take a look at genefilter package. John From: "Ochsner, Scott A" Sent: Mon, March 14, 2011 2:19:57 PM Subject: RE: [R] hclust() memor

Re: [R] Rscript, hashbang, and arguments

2011-03-14 Thread Gene Leynes
This might be off base, but would using --args help? It means "ignore everything else, Mr. R executable". However you can still parse it within the R environment. I use something like this in my startup file (.site file): if("--args" %in% commandArgs()){ i=grep("--args", commandArgs())

Re: [R] hclust() memory issue

2011-03-14 Thread Ochsner, Scott A
John, First, why are you trying to cluster so many rows? Presumably, if this is a gene expression array dataset, most of the array features are not going to change across treatments/conditions and will be relatively uninformative. Try using a filter which does not use treatment/condition info

Re: [R] recursive do.call

2011-03-14 Thread Gene Leynes
I'm not 100% sure of your problem... It seems that you may want to consider these functions rapply mapply Also, making a separate wrapper function for what you want to do. E.g.: ModelPrinterFun = function(dat){ model = glm(dist~speed, data=dat) print(coef(model), digits=3) } Model

Re: [R] data.frame transformation

2011-03-14 Thread andrija djurovic
David, thank you very much. I changed little bit my code and now it works. The magic word was stringsASfactor=FALSE and i didn't realize at the first time. Andrija On Mon, Mar 14, 2011 at 9:28 PM, David Winsemius wrote: > > On Mar 14, 2011, at 3:51 PM, andrija djurovic wrote: > > I would like

[R] File > Save As...

2011-03-14 Thread Gene Leynes
As much as I love R, there are still the occasional shortcomings. I would love to find a solution to the "save as..." problem. Steps to reproduce the problem: 1. Open any version of he R GUI in Windows 2. Choose "File > Open" from the menu 3. Open a script that is in a different directo

[R] hclust() memory issue

2011-03-14 Thread array chip
Hi, I have a microarray dataset of dimension 25000x30 and try to clustering using hclust(). But the clustering on the rows failed due to the size: > y<-hclust(dist(data),method='average') Error: cannot allocate vector of size 1.9 Gb I tried to increase the memory using memory.limit(size=3000), s

Re: [R] Conditional coloring

2011-03-14 Thread Peter Langfelder
On Mon, Mar 14, 2011 at 1:06 PM, Pavan G wrote: > Hello All, > I have a histogram with values above and below 0. I would like to color the > +ve bars green and -ve bars red. I am plotting data using: > > hist(a[,2],breaks=100,main="W3",xlab="Movement towards site (A)") > > Can someone please comme

[R] Rscript, hashbang, and arguments

2011-03-14 Thread Fong Chun Chan
Hi, I have a bunch of R scripts which have the hash bang !/usr/bin/env Rscript and I typically run these scripts by passing in some parameters like this: ./nameOfRScript arg1 arg2 ... I know Rscript has the option to run in --vanilla. Where exactly do I insert the --vanilla option? When I do s

Re: [R] recursive do.call

2011-03-14 Thread Thomas Lumley
On Tue, Mar 15, 2011 at 9:05 AM, Jeroen Ooms wrote: > Hmmm I was hoping there would be a more natural way to do it. For example, > if you actually try to call the first function with all arguments: > > lm(formula=dist~speed, digits=3, data=cars) > > R will match whatever it can, and give you a war

Re: [R] code for "permutative" operation

2011-03-14 Thread nblarson
You mean like cumsum()? > a<-1:10 > b<-cumsum(a) > b [1] 1 3 6 10 15 21 28 36 45 55 -Nick Larson -- View this message in context: http://r.789695.n4.nabble.com/code-for-permutative-operation-tp3354839p3354849.html Sent from the R help mailing list archive at Nabble.com. __

[R] Importing multiple shapefiles to run a loop

2011-03-14 Thread Nathaniel
Hi R Users, I commonly import multiple .csv files and then write loops to work with those files like this: >setwd('C://Nathaniel/R/allfiles') >files<-list.files() >allfiles<-lapply(t1,read.csv) >for (i in 1:47) { > t1<-allfiles[[i]] etc. etc. I have written a script that I would like to loo

Re: [R] code for "permutative" operation

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 4:16 PM, Sascha Vieweg wrote: On 11-03-14 21:09, David Winsemius wrote: On Mar 14, 2011, at 3:52 PM, Sascha Vieweg wrote: Hello, I need some form of a "permutative" operation on a numeric vector x x = (v1, v2, v3, ..., vN) that produces x.r = (v1, v1+2, v1+v2+v3, ... v

Re: [R] ideas on sorting

2011-03-14 Thread array chip
Thanks Martin! From: Martin Morgan Cc: r-help@r-project.org Sent: Mon, March 14, 2011 12:33:40 PM Subject: Re: [R] ideas on sorting On 03/14/2011 10:32 AM, array chip wrote: > Hi, I have a character vector as below: > > a<-c('10','3R','4','4R','5','5R','6','6

Re: [R] creating character vector

2011-03-14 Thread peter dalgaard
On Mar 14, 2011, at 16:32 , Allan Engelhardt wrote: > You could try > > scan(what=character(0), sep=",", file=textConnection("first,second,third")) > > > but better to put the strings in a file (say, strings.txt), one per line, and > read it using > > scan("strings.txt", what=character(0), s

Re: [R] data.frame transformation

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 3:51 PM, andrija djurovic wrote: I would like to hide cells with values less the 10%, so "." or just "" doesn't make me any difference. Also I used apply combined with as.character: apply(df, 2, function(x) ifelse(as.character(x) < 10,".",x)) This is, probably not a goo

Re: [R] code for "permutative" operation

2011-03-14 Thread Sascha Vieweg
On 11-03-14 21:09, David Winsemius wrote: On Mar 14, 2011, at 3:52 PM, Sascha Vieweg wrote: Hello, I need some form of a "permutative" operation on a numeric vector x x = (v1, v2, v3, ..., vN) that produces x.r = (v1, v1+2, v1+v2+v3, ... v1+v2+...+vN) If the operation is sum() I can run x

[R] Conditional coloring

2011-03-14 Thread Pavan G
Hello All, I have a histogram with values above and below 0. I would like to color the +ve bars green and -ve bars red. I am plotting data using: hist(a[,2],breaks=100,main="W3",xlab="Movement towards site (A)") Can someone please comment on how it can be done? Thanks! [[alternative HTML

Re: [R] code for "permutative" operation

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 3:52 PM, Sascha Vieweg wrote: Hello, I need some form of a "permutative" operation on a numeric vector x x = (v1, v2, v3, ..., vN) that produces x.r = (v1, v1+2, v1+v2+v3, ... v1+v2+...+vN) If the operation is sum() I can run x <- 5:8 m <- matrix(rep(x, length(x)), nc

Re: [R] recursive do.call

2011-03-14 Thread Jeroen Ooms
Hmmm I was hoping there would be a more natural way to do it. For example, if you actually try to call the first function with all arguments: lm(formula=dist~speed, digits=3, data=cars) R will match whatever it can, and give you a warning with the names of remaining unmatched arguments. The only

Re: [R] R hangs when connected via VPN [incl. minimal example]

2011-03-14 Thread Marius Hofert
Dear Duncan, Rich Calaway helped me narrowing down the error. The problem is that I can't execute the line cl<- makeCluster(mpi.universe.size(), type ="MPI") when I am connected via VPN. Rich finally suggested to post this on R-SIG-HPC, which I did a couple of minutes ago. Cheers, Marius On

Re: [R] AOV() may misslabel random effects.

2011-03-14 Thread peter dalgaard
On Mar 14, 2011, at 17:57 , Giles Crane wrote: > Greetings, > > The aov() function may mislabel > the random effects as in the example below: > Has anybody else noticed this? What's "mislabeled" about it??? Looks like you nave an unbalanced design (in which case, aov() may be the wrong tool.)

[R] code for "permutative" operation

2011-03-14 Thread Sascha Vieweg
Hello, I need some form of a "permutative" operation on a numeric vector x x = (v1, v2, v3, ..., vN) that produces x.r = (v1, v1+2, v1+v2+v3, ... v1+v2+...+vN) If the operation is sum() I can run x <- 5:8 m <- matrix(rep(x, length(x)), ncol=length(x)) (x.r <- rowsum(m * upper.tri(m, diag=TRU

Re: [R] data.frame transformation

2011-03-14 Thread andrija djurovic
I would like to hide cells with values less the 10%, so "." or just "" doesn't make me any difference. Also I used apply combined with as.character: apply(df, 2, function(x) ifelse(as.character(x) < 10,".",x)) This is, probably not a good solution, but it works except that I lose row names and

Re: [R] Math characters in column heading using latex() in Hmisc

2011-03-14 Thread christiaan pauw
Thank you Ista. It worked On 14 March 2011 14:36, Ista Zahn wrote: > Hi Christain, > You do not give us a reproducible example, nor do yo tell us how you > are creating the table. The following works fine for me: > > dat <- data.frame(x1=1, x2=2, x3=3, x4=4) > names(dat) <- c("$\\sum_{i}\\sum_

Re: [R] ideas on sorting

2011-03-14 Thread Martin Morgan
On 03/14/2011 10:32 AM, array chip wrote: Hi, I have a character vector as below: a<-c('10','3R','4','4R','5','5R','6','6R','7','8','9','7R','1','10R','11' ,'11R','12','12R','13','13R','14','14R','15','15R','1R','2','2R','3','8R' ,'9R') Is there a clever way to sort this easily to return a vect

Re: [R] *Building* a covariance matrix efficiently

2011-03-14 Thread Tsjerk Wassenaar
Hi Rex, You're right... I missed the proper route of thought :) I should read in a set of data that I can handle memory wise, calculate the covariance matrix and add it to the total... Sorry I assessed your suggestion the wrong way. Thanks a million, Tsjerk On Mar 14, 2011 7:58 PM, wrote: Ts

Re: [R] Plotting symbols and colors based upon data values

2011-03-14 Thread Brian Diggs
On 3/13/2011 6:46 PM, David Winsemius wrote: On Mar 13, 2011, at 8:51 PM, Mark Linderman wrote: David, thank you for your quick reply. I spent a few minutes getting your command to work with some sparse synthetic data, and then spent several hours trying to figure out why my data didn't work (

Re: [R] ideas on sorting

2011-03-14 Thread array chip
Thank you Bill. John From: William Dunlap Sent: Mon, March 14, 2011 10:47:39 AM Subject: RE: [R] ideas on sorting > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of array chip > Sent: Monda

Re: [R] data.frame transformation

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 2:52 PM, andrija djurovic wrote: Hi R users, I have following data frame df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156), q3=c("check","check",25,100),q4=c(7.123,35,100,"check")) and i would like to replace every element that is less then 10 with . (d

Re: [R] ideas on sorting

2011-03-14 Thread array chip
That's a smart way to do this. Thanks! John From: Berend Hasselman To: r-help@r-project.org Sent: Mon, March 14, 2011 10:49:37 AM Subject: Re: [R] ideas on sorting array chip wrote: > > Hi, I have a character vector as below: > > a<-c('10','3R','4','4R','5

Re: [R] creating character vector

2011-03-14 Thread Eik Vettorazzi
Hi Jim, this may be barking up the wrong tree, but create <-function(...) paste(substitute(list(...)))[-1] createl <-function(...) { tmp<-list(...) names(tmp)<-create(...) tmp } #eg a<-1:4 b<-letters[2:6] createl(a,b) works. But I can't imagine that a named list is the one and only useful d

Re: [R] data.frame transformation

2011-03-14 Thread Joshua Wiley
Dear Andrija, You could convert the factors to numeric class in order to test, get an index of cells and then replace those. I wonder though if it wouldn't be easier to do this at some step *before* the numbers are combined with strings? At any rate, take a look at ?which ?factor ?as.numeric ?

Re: [R] different regression coeffs with different starting point

2011-03-14 Thread Achim Zeileis
On Mon, 14 Mar 2011, Jen wrote: Hi Bill, Thanks for your response and I'm sorry -- that was a misleading example of what I was trying to show. This one should illustrate the point: require(AER) data_in = c(0,6,12,18,24,30,36,42,48,54,60,66,72,78) data_in2 = data_in^2 data_in3 = data_in^3 data_o

Re: [R] (no subject)

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 12:25 PM, Andreas Emanuelsson wrote: Hi everyone, I have problems with a double for loop and the program response: "Error in 1:mass[j] : NA/NaN argument" I'm trying to create a very simple script to generate a vector full of objects with the value [fuel] and in the amou

Re: [R] *Building* a covariance matrix efficiently

2011-03-14 Thread rex.dwyer
Tsjerk, It seems to me that memory and not time is your big efficiency problem, and I've showed you how to avoid storing your entire input. If you want to avoid doing each multiplication twice, you can replace the "outer" with a function that computes each product only once and accumulate sums o

[R] data.frame transformation

2011-03-14 Thread andrija djurovic
Hi R users, I have following data frame df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156), q3=c("check","check",25,100),q4=c(7.123,35,100,"check")) and i would like to replace every element that is less then 10 with . (dot) in order to obtain this: q1q2q3q4 1

Re: [R] (no subject)

2011-03-14 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Andreas Emanuelsson > Sent: Monday, March 14, 2011 9:25 AM > To: r-help@r-project.org > Subject: [R] (no subject) > > Hi everyone, I have problems with a double for loop and the p

[R] Fitting 4 moments distribution w/ Mixture Gaussian

2011-03-14 Thread Sam R
Hello, I know that Mclust does the fitting on its own but I am trying to implement an optimization with the aim to generate a the mixture gaussian with the combine moments as closed as possible to the moment of my return distribution. The objective is to Min Abs((Mean Ret - MeanFit)/Mean Fit) +

Re: [R] different regression coeffs with different starting point

2011-03-14 Thread Jen
Hi Bill, Thanks for your response and I'm sorry -- that was a misleading example of what I was trying to show. This one should illustrate the point: require(AER) data_in = c(0,6,12,18,24,30,36,42,48,54,60,66,72,78) data_in2 = data_in^2 data_in3 = data_in^3 data_out = c(139487.00,13.00,62500.00

[R] (no subject)

2011-03-14 Thread Andreas Emanuelsson
Hi everyone, I have problems with a double for loop and the program response: "Error in 1:mass[j] : NA/NaN argument" I'm trying to create a very simple script to generate a vector full of objects with the value [fuel] and in the amount [mass] for a hist plot. H=1 for (j in 1:63)

Re: [R] creating character vector

2011-03-14 Thread Eik Vettorazzi
Hi Jim create <-function(...) paste(substitute(list(...)))[-1] create(a,b,c) should work. hth. Am 14.03.2011 10:29, schrieb Maas James Dr (MED): > Is there a way to convince R to create a character vector without using the > quotes? > > This works > > ex1 <- c("first","second") > > but w

Re: [R] increase a value by each group?

2011-03-14 Thread Dennis Murphy
I think you meant to use Depth as the grouping factor rather than s_name: > ddply(my_data, .(s_name), function(x){ + x$Im_looking <- x$Depth + as.numeric(factor(x$s_name)) / 100 + x + }) Depth s_name index Im_looking 1 3852 Site_1 1443852.01 2 3852 Site_1 1443852

Re: [R] Installing Rmpi on hpc

2011-03-14 Thread Prof Brian Ripley
On Mon, 14 Mar 2011, Brian Smith wrote: Hi, I was trying to install the package Rmpi on a hpc cluster running SGE. The Which is what? (If Sun Grid Engine, not relevant and it is your unstated OS that we needed to know. Not just 'Linux', but the precise distro.)) Please do note the posti

Re: [R] increase a value by each group?

2011-03-14 Thread Hadley Wickham
On Mon, Mar 14, 2011 at 9:59 AM, ONKELINX, Thierry wrote: > Something like this? > > my_data=read.table("clipboard", header=TRUE) > my_data$s_name <- factor(my_data$s_name) > library(plyr) > ddply(my_data, .(s_name), function(x){ >        x$Im_looking <- x$Depth + as.numeric(x$s_name) / 100 >    

Re: [R] ideas on sorting

2011-03-14 Thread Berend Hasselman
array chip wrote: > > Hi, I have a character vector as below: > > a<-c('10','3R','4','4R','5','5R','6','6R','7','8','9','7R','1','10R','11' > ,'11R','12','12R','13','13R','14','14R','15','15R','1R','2','2R','3','8R' > ,'9R') > > Is there a clever way to sort this easily to return a vector of in

Re: [R] ideas on sorting

2011-03-14 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of array chip > Sent: Monday, March 14, 2011 10:33 AM > To: r-help@r-project.org > Subject: [R] ideas on sorting > > Hi, I have a character vector as below: > > a<-c('10','3R','4',

Re: [R] use "caret" to rank predictors by random forest model

2011-03-14 Thread mxkuhn
Xiaoqi, You need to specify the sizes. There are other search algorithms that auotmatically pick the size (such as genetic algorithms), but I don't have those in the package yet. Another approach is to use univariate filtering (see the sbf function in caret). Max On Mar 13, 2011, at 8:49 PM,

Re: [R] system(..., invisible=FALSE, show.output.on.console=FALSE) in Windows 7

2011-03-14 Thread Ralph Olsson
Yes, shell("start") works. R does not wait for the command prompt to be closed, but this can be worked around by running shell("start /WAIT") so it looks like this should give a solution our guy's can use. Many thanks, Ralph --- On Fri, 11/3/11, Gabor Grothendieck wrote: From: Gabor Grothen

[R] ideas on sorting

2011-03-14 Thread array chip
Hi, I have a character vector as below: a<-c('10','3R','4','4R','5','5R','6','6R','7','8','9','7R','1','10R','11' ,'11R','12','12R','13','13R','14','14R','15','15R','1R','2','2R','3','8R' ,'9R') Is there a clever way to sort this easily to return a vector of index that would produce a vector as

Re: [R] Goodness of fit with robust regression

2011-03-14 Thread Bert Gunter
Hi: Just a few additional comments to Spencer's. 1. There is an R-SIG-Robust group that you may wish to post your question to if you have not already done so. There you **should** find experts to help you, of which I'm also not one. 2. The situation regarding the effectiveness of robust techniqu

[R] AOV() may misslabel random effects.

2011-03-14 Thread Giles Crane
Greetings, The aov() function may mislabel the random effects as in the example below: Has anybody else noticed this? Cordially, Giles Crane, MPH, ASA, NJPHA gilescr...@verizon.net > m2 Call: aov(formula = y ~ ap + pe + Error(ju), data = d) Grand Mean: 77.50667 Stratum 1: ju Terms:

Re: [R] *Building* a covariance matrix efficiently

2011-03-14 Thread rex.dwyer
Tjerk, This is just a pseudo code outline of what you need to do: M = matrix(0, number of variables, number of variables) V = rep(0, number of variables) N = 0 While (more observations to read) { X <- next observation V <- V + X M <- M + outer(X,X) N <- N+1 } Compute covariance matrix

Re: [R] JAGS/BUGS on gene expression data

2011-03-14 Thread Whit Armstrong
There are better alternatives for big data than to revert to C. http://code.google.com/p/pymc/ http://github.com/armstrtw/CppBugs (still alpha) -Whit On Mon, Mar 14, 2011 at 11:06 AM, nblarson wrote: > Has anybody had issues running MCMC (either BUGS or JAGS) on data sets of > this magnitude (

[R] Installing Rmpi on hpc

2011-03-14 Thread Brian Smith
Hi, I was trying to install the package Rmpi on a hpc cluster running SGE. The command, and the sessionInfo() is as follows: === > install.packages("Rmpi",dependencies=TRUE) also installing the dependency ‘rsprng’ trying URL ' http://www.ibiblio.org/pub/la

Re: [R] creating character vector

2011-03-14 Thread nblarson
The reason this doesn't work is because R thinks that in the command as.character(c(first,second)) that first and second are variables that exist within the working environment. Since they don't (I assume), R doesn't know what to do with the command. Using the quotes indicates to R that you're s

Re: [R] Kendall Theil line as fit?

2011-03-14 Thread jonbfish
Thanks, that is what I was trying to do. From: Peter Ehlers [via R] [mailto:ml-node+3350009-943873321-216...@n4.nabble.com] Sent: Saturday, March 12, 2011 4:27 AM To: Anthony Seeman Subject: Re: Kendall Theil line as fit? On 2011-03-11 17:10, jonbfish wrote: > Th

[R] JAGS/BUGS on gene expression data

2011-03-14 Thread nblarson
Has anybody had issues running MCMC (either BUGS or JAGS) on data sets of this magnitude (ie 30k x 20-30). I've been trying to run a hierarchical random effects model on expression data but R completely stalls out on jobs run on 32bit R on our server (doesn't respond...then eventually crashes out

Re: [R] using initialize or using a constructor function

2011-03-14 Thread Martin Morgan
On 03/13/2011 09:01 PM, Laura Smith wrote: Hi I'm trying to learn about S4 methods, classes, etc. Is it better to use initialize or use a construction function, please? Hi Laura -- partly a matter of taste; 'initialize' actually establishes quite a complicated contract, and I find it easier

Re: [R] Serial Date

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 6:36 AM, Allan Engelhardt wrote: On 14/03/11 02:00, Raoni Rosa Rodrigues wrote: Hello R Help, I'm working in a project with a software that register date and time data in serial time format. This format is used by excel, for exemple. In this format, 40597.3911423958

Re: [R] Goodness of fit with robust regression

2011-03-14 Thread Spencer Graves
I'm not an expert on robust modeling. However, as far as I know, most robust regression procedures are based on heuristics, justified by claims that "it seems to work" rather than reference to assumptions about a probability model that makes the procedures "optimal". There may be except

Re: [R] increase a value by each group?

2011-03-14 Thread Ortiz, John
Hi Tierry, Thanks for your answer, that is very close to I'm looking, but there are this difference: whit your code I get this: Depth s_name indice Im_looking 3852Site_1 144 3852.01 3852Site_1 144 3852.01 3852Site_1 144 3852.01 3852site_A 145 3852.02 3852

Re: [R] different regression coeffs with different starting point

2011-03-14 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jen > Sent: Monday, March 14, 2011 3:27 AM > To: r-help@r-project.org > Subject: [R] different regression coeffs with different starting point > > Hi all, > I have a question ab

Re: [R] value of W seems to be suspicious in the mann-whitney wilcox related test. what could be the problem

2011-03-14 Thread taby gathoni
Dear Abhijit, Maybe am using the wrong test. But all i need is calculate non-parametrically the accuracy ratios of my samples. Ideally for that kind of an output then the answer would be between 0 and 1. notice also one of my variable is a non-numeric. Thank Taby An idea not coupled wit

Re: [R] creating character vector

2011-03-14 Thread Allan Engelhardt
You could try scan(what=character(0), sep=",", file=textConnection("first,second,third")) but better to put the strings in a file (say, strings.txt), one per line, and read it using scan("strings.txt", what=character(0), sep="\n") Even better is to understand what you are really trying to

Re: [R] value of W seems to be suspicious in the mann-whitney wilcox related test. what could be the problem

2011-03-14 Thread Abhijit Dasgupta
You need to read up on the Wilcoxon signed-rank test and the output from wilcox.test!!! The confidence interval is of the difference of medians, which can certainly be negative. In fact, your estimate is -33, and the confidence interval is (-68, 0) which is reasonable. The value of W is a posi

Re: [R] value of W seems to be suspicious in the mann-whitney wilcox related test. what could be the problem

2011-03-14 Thread Abhijit Dasgupta
You need to read up on the Wilcoxon signed-rank test and the output from wilcox.test!!! The confidence interval is of the difference of medians, which can certainly be negative. In fact, your estimate is -33, and the confidence interval is (-68, 0) which is reasonable. The value of W is a posi

Re: [R] increase a value by each group?

2011-03-14 Thread ONKELINX, Thierry
Something like this? my_data=read.table("clipboard", header=TRUE) my_data$s_name <- factor(my_data$s_name) library(plyr) ddply(my_data, .(s_name), function(x){ x$Im_looking <- x$Depth + as.numeric(x$s_name) / 100 x }) Best regards, Thierry ---

[R] value of W seems to be suspicious in the mann-whitney wilcox related test. what could be the problem

2011-03-14 Thread taby gathoni
my output is as follows:  wilcox.test(main_samp$SCORE~main_samp$GENDER, conf.int = TRUE)     Wilcoxon rank sum test with continuity correction data:  main_samp$SCORE by main_samp$GENDER W = 2780.5, p-value = 0.04829 alternative hypothesis: true location shift is not equal to 0 95 percent con

Re: [R] Large dataset operations

2011-03-14 Thread hi Berven
Thanks for the help! All the methods above worked well and cleared up some misunderstandings. Thanks! Haakon =) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat

[R] RE : creating character vector

2011-03-14 Thread Wolfgang RAFFELSBERGER
Jim, I don't know if this is the most elegant solution : Copy the following to your clipboard (some editors will require also to take last paragraph mark) first second third > ## now go to R and use > dat <- read.table("clipboard") # will give data.frame > dat V1 1 first 2 second 3 thi

[R] proportional symbol map ggplot

2011-03-14 Thread Strategische Analyse CSD Hasselt
Hello, we want to plot a proportional symbol map with ggplot. Symbols' area should have the same proportions as the scaled variable. Hereby an example we found on http://www.r-bloggers.com/bubble-chart-by-using-ggplot2/ . In this example we see the proportions of the symbols' area are differen

Re: [R] Developing a web crawler

2011-03-14 Thread Evanescence
Can i ask a question> Do I need a good math for developing a web crawler ? ( I want to develop a simple web crawler to do something ) -- View this message in context: http://r.789695.n4.nabble.com/Developing-a-web-crawler-tp3332993p3353291.html Sent from the R help mailing list archive at Nabble

[R] different regression coeffs with different starting point

2011-03-14 Thread Jen
Hi all, I have a question about the optimisation methods used in nonlinear regression. I have some data that I would like to fit a tobit regression model to (see code below). It seems that the solution is very sensitive to the initial condition that I give it - is there any option to use a differen

[R] Cox model, model averaging and survival curve

2011-03-14 Thread Martin Patenaude-Monette
Dear community, I have done model selection between candidate Cox models, using AICc calculated with penalized log likelihoods. Then model averaging was done to obtain model averaged parameter estimates. Is there a way to plot survival curve from the averaged model, by estimating baseline hazard a

[R] Help- Fitting a Thin Plate Spline

2011-03-14 Thread kehoe
Hi Everyone, I'm a pretty useless r-er but have data that SPSS etc doesn't like. I've managed to do GLMs for my data, but now need to fit a thin plate spline for my data (arcsine.success~date.num:clutch.size) If anyone has a bit of spare time and could come up with a bit of code I'd be very gratef

[R] basic question about S4 and methods not found

2011-03-14 Thread Gabriel.Cardi
Hi guys I have a basic question about S4 stuff Here is how I do it: setGenericVerif <- function(x,y){if(!isGeneric(x)){setGeneric(x,y)}else{}} # from the genolini intro to S4 # here is the class setClass("RiskBuckets", representation( ... xxx ... ) ) # here

  1   2   >