[R] Help with reshape/reShape and indexing

2009-05-13 Thread Dana Sevak
Dear R Helpers, I have trouble applying reShape and reshape although I read the documentation and several posts, so I would very much appreciate your help on the two points below. I have a dataframe df = data.frame(Name=c(a, a, a, b, b, c), X1=c(12, 13, 14, 20, 25, 30), X2 = c(200, 250,

Re: [R] Overlay cdf

2009-05-13 Thread Bill.Venables
Here are some ideas you might like to consider par(mar = c(5,4,2,4)+0.1, yaxs = r) Sample - rgamma(1000,2.5,.8) hist(Sample, main = , freq = FALSE, ylim = c(0,1)) pu - par(usr)[1:2] x - seq(pu[1], pu[2], len = 5000) y - pgamma(x, 2.5, 0.8) par(new = TRUE) plot(x, y, type = l, axes = FALSE, ann =

Re: [R] creating a postscript file with two xyplots

2009-05-13 Thread Dieter Menne
Liati liats80 at hotmail.com writes: I would like to create one postscript file with two different xyplots (which library(lattice) postscript(myps.ps) xyplot(1~1,main=Plot 1) xyplot(2~3,main=Plot 2) dev.off() Dieter __ R-help@r-project.org mailing

Re: [R] import HTML tables

2009-05-13 Thread Dieter Menne
Dimitri Szerman-2 wrote: Hello, I was wondering if there is a function in R that imports tables directly from a HTML document. The XML package can do this: http://markmail.org/message/cyicoa3htme4gei2 Duncan Temple Lang: The htmlParse() and htmlTreeParse() functions in the XML package

Re: [R] adonis help - (non-parametric (permutational) manova)

2009-05-13 Thread Gavin Simpson
On Tue, 2009-05-12 at 15:53 -0400, stephen sefick wrote: I am trying to apply this technique (M.J Anderson 2001) to a dataset of aquatic insect abundances. There is a sample in the unrestored and restored segement of a stream for every time period. I would like to compare the centroids of

Re: [R] Do you use R for data manipulation?

2009-05-13 Thread Wacek Kusnierczyk
Warren Young wrote: Farrel Buchinsky wrote: Is R an appropriate tool for data manipulation and data reshaping and data organizing? I think so but someone who recently joined our group thinks not. The new recruit believes that python or another language is a far better tool for developing

Re: [R] adonis help - (non-parametric (permutational) manova)

2009-05-13 Thread Gavin Simpson
Apologies, I seem to have deleted the important part of a sentence below: On Wed, 2009-05-13 at 09:37 +0100, Gavin Simpson wrote: snip / adonis(a~site, data=b, strata=b[,date] ,Permutations=999) I don't think the permutations will be stratified correctly - you want them to represent a time

Re: [R] survival curves for time dependent covariates (was consultation)

2009-05-13 Thread Heinz Tuechler
At 14:50 12.05.2009, Terry Therneau wrote: *I´m writing to ask you how can I do Survivals Curves using Time-dependent *covariates? Which packages I need to Install?* This is a very difficult problem statistically. That is, there are not many good ideas for what SHOULD be done. Hence,

[R] Segmentation fault in package rJava on CentOS server

2009-05-13 Thread Carlos J. Gil Bellosta
Hello, I just installed rJava on [r...@ug13 ~]# R --version R version 2.9.0 (2009-04-17) runing on a [r...@ug13 ~]# cat /etc/redhat-release CentOS release 5.3 (Final) This is the output of [r...@ug13 ~]# R CMD javareconf Java interpreter : /usr/bin/java Java version : 1.4.2_18 Java home

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Uwe Ligges
Dana Sevak wrote: Dear R Helpers, I have trouble applying reShape and reshape although I read the documentation and several posts, so I would very much appreciate your help on the two points below. I have a dataframe df = data.frame(Name=c(a, a, a, b, b, c), X1=c(12, 13, 14, 20, 25, 30),

Re: [R] Response surface plot

2009-05-13 Thread Tim Carnus
HI, thank you for that. I had come across a while ago a presentation outlining the ideas for such a function but can't remember who or where. Thanks again, Tim - Original Message - From: Duncan Murdoch murd...@stats.uwo.ca Date: Tuesday, May 12, 2009 4:26 pm Subject: Re: [R] Response

Re: [R] Multiple plot margins

2009-05-13 Thread Uwe Ligges
Andre Nathan wrote: Hello I'm plotting 6 graphs using mfrow = c(2, 3). In these plots, only graphs in the first column have titles for the y axis, and only the ones in the last row have titles for the x axis. I'd like all plots to be of the same size, and I'm trying to keep them as near each

[R] where does the null come from?

2009-05-13 Thread Wacek Kusnierczyk
m = matrix(1:4, 2) apply(m, 1, cat, '\n') # 1 2 # 3 4 # NULL why the null? vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Dimitris Rizopoulos
one way is the following: df.index - df df.index$Index - ave(seq_along(df$Name), df$Name, FUN = seq_along) df.index df2 - reshape(df.index[c(Name, Index, X1)], timevar = Index, idvar = Name, direction = wide) df2 I hope it helps. Best, Dimitris Dana Sevak wrote: Dear R Helpers, I have

Re: [R] questions on rpart (tree changes when rearrange the order of covariates?!)

2009-05-13 Thread Uwe Ligges
Yuanyuan wrote: Greetings, I am using rpart for classification with class method. The test data is the Indian diabetes data from package mlbench. I fitted a classification tree firstly using the original data, and then exchanged the order of Body mass and Plasma glucose which are the

Re: [R] where does the null come from?

2009-05-13 Thread K. Elo
Hi! Wacek Kusnierczyk wrote: m = matrix(1:4, 2) apply(m, 1, cat, '\n') # 1 2 # 3 4 # NULL why the null? Could it be the return value of 'cat'. See ?cat, where: ---snip --- Value None (invisible NULL). ---snip --- Kind regrads, Kimmo

Re: [R] where does the null come from?

2009-05-13 Thread Peter Dalgaard
Wacek Kusnierczyk wrote: m = matrix(1:4, 2) apply(m, 1, cat, '\n') # 1 2 # 3 4 # NULL why the null? It comes from unlist()ing a list of NULLs, which in turn are the return values of cat(). It is arguably a design-buglet not to return list(NULL, NULL), but the

Re: [R] where does the null come from?

2009-05-13 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: Wacek Kusnierczyk wrote: m = matrix(1:4, 2) apply(m, 1, cat, '\n') # 1 2 # 3 4 # NULL why the null? It comes from unlist()ing a list of NULLs, which in turn are the return values of cat(). yes; i'd think i'd get a list of nulls,

[R] Help with a cumullative Hazrd Ratio plot

2009-05-13 Thread Bernardo Rangel Tura
Hi R-masters I need help to make modified cumulative hazard ratio plot. I need create a common plot but with the number of subjects in risk each ticks times for two different groups in bottom of plot (I put one example in attach). Do you know a routine for this? Is possible create a routine for

[R] Multiple ANOVA tests

2009-05-13 Thread Imri
Hello!!! I'm trying to do multiple ANOVA tests with R (testing the affect off different factors on the same response). As a result I get many ANOVA tables, and I want to extract a list of the Pr(F) from all the tables. Maybe someone have an idea how to do this? Thanks Imri -- View

Re: [R] converting numeric into character strings

2009-05-13 Thread Olivier ETERRADOSSI
Hi Melissa unless I miss a point, you should get what you want with (for example) y-paste(b,collapse=,) Hope this helps. Olivier Melissa2k9 wrote: Hi, Im trying to put some numbers into a dataframe , I have a list of numbers (change points in a time series) like such [1] 2 11 12 20

Re: [R] plotting a grid with color on a map

2009-05-13 Thread Ray Brownrigg
dxc13 wrote: Hi all, I have posted similar questions regarding this topic, but I just can't seem to get over the hump and find a straightforward way to do this. I have attached my file as a reference. Basically, the attached file is a 5 degree by 5 degree grid of the the world (2592 cells),

Re: [R] Overlay cdf

2009-05-13 Thread Matthieu Dubois
You might also use ?curve # same example as Bill's par(mar = c(5,4,2,4)+0.1, yaxs = r) Sample - rgamma(1000,2.5,.8) hist(Sample, main = , freq = FALSE, ylim = c(0,1)) curve(pgamma(x, 2.5, 0.8), add=T, col='red') curve(dgamma(x, 2.5, 0.8), add=T, col='darkgreen') axis(4, col = red) mtext(side =

Re: [R] Help with a cumullative Hazrd Ratio plot

2009-05-13 Thread Nutter, Benjamin
?mtext You may need to adjust the margins. For this I recommend adjusting that mar option in par (see ?par). -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bernardo Rangel Tura Sent: Wednesday, May 13, 2009 6:31 AM To: r-help

[R] overlap contour

2009-05-13 Thread Bala subramanian
Friends, I have two covariance matrices (m1 and m2) of same size (150x150). I used contourplot function to make contour plots individually (c1 and c2). I am interested in making one contourplot overlapping the two individual contours so that the portion of the plot above and below the diagonal

Re: [R] plotting a grid with color on a map

2009-05-13 Thread Jim Lemon
dxc13 wrote: Hi all, I have posted similar questions regarding this topic, but I just can't seem to get over the hump and find a straightforward way to do this. I have attached my file as a reference. Basically, the attached file is a 5 degree by 5 degree grid of the the world (2592 cells),

Re: [R] plotting a grid with color on a map

2009-05-13 Thread Jim Lemon
Oops, forgot to include: library(plotrix) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal,

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Gabor Grothendieck
Try this: DF$Index - ave(1:nrow(DF), DF$Name, FUN = seq_along) reshape(DF[-3], dir = wide, idvar = Name, timevar = Index) Also see the reshape package for another similar facility. On Wed, May 13, 2009 at 2:02 AM, Dana Sevak dana.se...@yahoo.com wrote: Dear R Helpers, I have trouble

Re: [R] questions on rpart (tree changes when rearrange the order of covariates?!)

2009-05-13 Thread Liaw, Andy
From: Uwe Ligges Yuanyuan wrote: Greetings, I am using rpart for classification with class method. The test data is the Indian diabetes data from package mlbench. I fitted a classification tree firstly using the original data, and then exchanged the order of Body mass and

Re: [R] plotting a grid with color on a map

2009-05-13 Thread Jim Lemon
It was the NAs that fooled color2D.matplot. This gets your colors, although not exactly what you want. Look at the help for color2D.matplot to get that. I think fiddling with the x and y limits on the map() call will get the positions right. temp1-read.table(time1test.dat,header=TRUE)

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread hadley wickham
This does it more or less your way: ds - split(df, df$Name) ds - lapply(ds, function(x){x$Index - seq_along(x[,1]); x}) df2 - unsplit(ds, df$Name) tapply(df2$X1, df2[,c(Name, Index)], function(x) x) athough there may exist much easier ways ... Here's one way with the plyr and reshape

Re: [R] silhouette: clustering labels have to be consecutive integers starting

2009-05-13 Thread Martin Maechler
TS == Tao Shi shi...@hotmail.com on Wed, 10 Oct 2007 06:15:53 + writes: TS Thank you very much, Benilton and Prof. Ripley, for the TS speedy replies! TS Looking forward to the fix! TS Tao I have finally re-stumbled onto this e-mail thread, and indeed found fixed

Re: [R] AFT-model with time-dependent covariates

2009-05-13 Thread Terry Therneau
The coding for an AFT model with time-dependent covariates will be very hard, and I don't know of anyone who has done it. (But I don't keep watch of other survival packages, so something might be there). In a Cox model, a subject's risk depends only on the current value of his/her

Re: [R] plotCI line types for line and for bar

2009-05-13 Thread lehe
Thank you! Yes, I am using the plotCI from gplots and I want the line connecting the centers to be dashed, just as for the bars. However changing the type to be p as you said does not give dashed line but no line at all (only points). lehe wrote: Anyone has some clue to this question?

Re: [R] questions on rpart (tree changes when rearrange the order of covariates)

2009-05-13 Thread Terry Therneau
If two variables have exactly the same split importance, then rpart will use the one that was first in the model statement. So if rpart(group ~ age + height + weight + sex) and at some split point both age and weight gave a split with 20 correct and 9 incorrect, then age would be used

Re: [R] Looking for a quick way to combine rows in a matrix

2009-05-13 Thread Rocko22
Hello, I reviewed my code and this will work now for any number of successive TA, I hope: b=matrix(1:64, ncol=4) rownames(b)=rep(c(AA,AT,TA,TT),each=4) key - rownames(b) key[key == AT] - TA c - b rownames(c)=key for(i in 2:I(nrow(c))) { if(rownames(c)[i]==TA rownames(c)[i-1]==TA) { c[i,] -

[R] R package to fit mixture or cure survival models

2009-05-13 Thread marc bernard
Dear All, I am desperately trying to find any R package that fits a mixture survival models also know as a cure models. These are survival models where the survival function is improper, which also means that a fraction of subjects are expected not to expreience the event. A huge

[R] Nagelkerkes R2N

2009-05-13 Thread Andrea Weidacher
Hello All, as I´m new to R and survival analysis, I´ve got a question about the Design::validate function: My Code: cox - cph(Surv(t,status) ~ var1 + var2 + var3, data=data, x=TRUE, y=TRUE, surv=TRUE) cox.val - validate(cox, B=10, dxy=TRUE, pr=TRUE); My output (cox.val):

Re: [R] plotCI line types for line and for bar

2009-05-13 Thread Ben Bolker
lehe wrote: Thank you! Yes, I am using the plotCI from gplots and I want the line connecting the centers to be dashed, just as for the bars. However changing the type to be p as you said does not give dashed line but no line at all (only points). Yes, but the next line

Re: [R] strucchange | weighted models

2009-05-13 Thread Achim Zeileis
On Tue, 12 May 2009, f.query wrote: Greetings - Am hoping to use the strucchange package to look for structural breaks in some messy regression data. A series of preliminary analyses indicate that BLUE for these data will involve some weighting the data (estimates of a particular population

Re: [R] silhouette: clustering labels have to be consecutive integers starting

2009-05-13 Thread Carvalho, Benilton
Thank you very much, Martin. Warmest regards, b Em 13/05/2009, às 09:14, Martin Maechler maech...@stat.math.ethz.ch escreveu: !#x000a TS == Tao Shi shi...@hotmail.com on Wed, 10 Oct 2007 06:15:53 + writes: TS Thank you very much, Benilton and Prof. Ripley, for the TS speedy

[R] Help with reshape/reShape and indexing

2009-05-13 Thread Ista Zahn
Hi Dana, -- Forwarded message -- From: Dana Sevak dana.se...@yahoo.com To: r-help@r-project.org Date: Tue, 12 May 2009 23:02:00 -0700 (PDT) Subject: [R] Help with reshape/reShape and indexing Dear R Helpers, I have trouble applying reShape and reshape although I read the

Re: [R] Overlay cdf

2009-05-13 Thread beetle2
Thanks alot I found the function x0 - c(0, sort(Sample)) p0 - 0:1000/1000 lines(x0, p0, type = S, col = blue) Very helpfull As it seems to plot an instantaneous representation of the variables in the gamma distribution Bill.Venables wrote: Here are some ideas you might like to consider

[R] converting numeric into character strings

2009-05-13 Thread Melissa2k9
Hi, Im trying to put some numbers into a dataframe , I have a list of numbers (change points in a time series) like such [1] 2 11 12 20 21 98 99 but I want R to recognise this as just a character string so it will put it in one row and column, ideally I want them seperated by commas so I

Re: [R] plotting a grid with color on a map

2009-05-13 Thread dxc13
Thanks, Jim. This seems to be what I am looking for. Just have to fine tune the colors to get some distinctive greens, blues, yellows and oranges in there and I should be good to go. Jim Lemon-2 wrote: It was the NAs that fooled color2D.matplot. This gets your colors, although not

[R] read multiple large files into one dataframe

2009-05-13 Thread SYKES, Jennifer
Hello Apologies if this is a simple question, I have searched the help and have not managed to work out a solution. Does anybody know an efficient method for reading many text files of the same format into one table/dataframe? I have around 90 files that contain continuous data over 3

[R] Mixture of survivals or cure models

2009-05-13 Thread marc bernard
Dear All, I am desperately trying to find any R package that fits a mixture survival models also know as a cure models. This are survival model where the survival function is improper which also means that a fraction of subjects are expected not to expreience the event. A Huge

Re: [R] converting numeric into character strings

2009-05-13 Thread Jorge Ivan Velez
Dear Melissa, Try this: x - c(2, 11, 12, 20, 21, 98, 99) paste(x, collapse=,) [1] 2,11,12,20,21,98,99 See ?paste for more information. HTH, Jorge On Wed, May 13, 2009 at 5:53 AM, Melissa2k9 m.mcquil...@lancaster.ac.ukwrote: Hi, Im trying to put some numbers into a dataframe , I have

[R] 3dscatter for linux

2009-05-13 Thread threshold
Hi, do you have any suggestions how to make 3D scatterplot, BUT under linux. Worth mentioning is the fact that 'scatterplot3d' does not load under Ubuntu 8.10. Do you know any alternatives?? I tried cloud or persp but X,Y and Z axes are emprical in my case, and cannot be replaced by any seq(...).

Re: [R] Mixture of survivals or cure models

2009-05-13 Thread Gabor Grothendieck
Check out: http://www.math.mun.ca/~ypeng/research/ On Wed, May 13, 2009 at 8:34 AM, marc bernard marc_bern...@hotmail.co.uk wrote: Dear All, I am desperately trying to find any R package that fits a mixture survival models also know as a cure models. This  are survival model where the

Re: [R] Mixture of survivals or cure models

2009-05-13 Thread Gabor Grothendieck
Also: http://post.queensu.ca/~pengp/software.html On Wed, May 13, 2009 at 9:21 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Check out: http://www.math.mun.ca/~ypeng/research/ On Wed, May 13, 2009 at 8:34 AM, marc bernard marc_bern...@hotmail.co.uk wrote: Dear All, I am

Re: [R] overlap contour

2009-05-13 Thread Ben Bolker
Bala subramanian-2 wrote: Friends, I have two covariance matrices (m1 and m2) of same size (150x150). I used contourplot function to make contour plots individually (c1 and c2). I am interested in making one contourplot overlapping the two individual contours so that the portion of

Re: [R] Multiple ANOVA tests

2009-05-13 Thread Tal Galili
Hi lmri. You could do this by doing something like this: Getting an Anova first:# utils::data(npk, package=MASS) ( npk.aov - aov(yield ~ block + N*P*K, npk) ) summary(npk.aov) # I want the P value from this summary of aov object. #here is the code: summary(npk.aov)[[1]]$P # [1] 0.015938790

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread baptiste auguie
I'd first try plyr and see if it's efficient enough, library(plyr) listOfFiles - list.files(pattern= .txt) d - ldply(listOfFiles, read.table) str(d) alternatively, d - do.call(rbind, lapply(listOfFiles, read.table)) HTH, baptiste On 13 May 2009, at 12:45, SYKES, Jennifer wrote:

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread Mike Lawrence
What types of data are in each file? All numbers, or a mix of numbers and characters? Any missing data or special NA values? On Wed, May 13, 2009 at 7:45 AM, SYKES, Jennifer jennifer.sy...@nats.co.uk wrote: Hello Apologies if this is a simple question, I have searched the help and have not

Re: [R] 3dscatter for linux

2009-05-13 Thread Ben Bolker
threshold wrote: Hi, do you have any suggestions how to make 3D scatterplot, BUT under linux. Worth mentioning is the fact that 'scatterplot3d' does not load under Ubuntu 8.10. Do you know any alternatives?? I tried cloud or persp but X,Y and Z axes are emprical in my case, and cannot be

Re: [R] questions on rpart (tree changes when rearrange the order of covariates?!)

2009-05-13 Thread Dimitri Liakhovitski
I wonder - isn't this issue one of the reasons to use RandomForests rather than CART? On Wed, May 13, 2009 at 8:03 AM, Liaw, Andy andy_l...@merck.com wrote: From: Uwe Ligges Yuanyuan wrote: Greetings, I am using rpart for classification with class method. The test data  is the Indian

Re: [R] import HTML tables

2009-05-13 Thread Duncan Temple Lang
Dieter Menne wrote: Dimitri Szerman-2 wrote: Hello, I was wondering if there is a function in R that imports tables directly from a HTML document. The XML package can do this: http://markmail.org/message/cyicoa3htme4gei2 Duncan Temple Lang: The htmlParse() and htmlTreeParse() functions

[R] name siz ein cluster

2009-05-13 Thread Penner, Johannes
I would like to change to size of the names in a cluster dendrogram (not the axis or the header) (package clue). The normal things (pch, cex.label, font) do not work here. Thanks in advance! Johannes __ R-help@r-project.org mailing list

[R] access to the current element of lapply

2009-05-13 Thread Martial Sankar
Dear All, I would like to use the 'split' function on the dataframe elements contained in a list L. For example : (df - data.frame(cbind(c(rep('A',2), rep('B',2)), rep(1:4 X1 X2 1 A 1 2 A 2 3 B 3 4 B 4 (L-split(df, df$X1)) $A X1 X2 1 A 1 2 A 2 $B X1 X2 3 B 3 4 B

Re: [R] Nagelkerkes R2N

2009-05-13 Thread Frank E Harrell Jr
A new version of Design will be posted to CRAN in the next 2 days. After than, update your system, including an update to the survival package. Then re-try. Your formula is wrong as it can't be negative. LR should be the likelihood ratio chi-square stat : -2 times the difference in the two

[R] rpart - not for classification?

2009-05-13 Thread Dimitri Liakhovitski
Hello! I very minor point. I typed help.search(classification). It found a bunch of things including randomForests - which makes a lot sense. I am wondering why rpart was not found. I think - it should make sense too. -- Dimitri Liakhovitski MarketTools, Inc.

Re: [R] name siz ein cluster

2009-05-13 Thread Simon Pickett
I'm afraid I have no experience with the clue package, but if all else fails you could consider the hclust package. You change font size in the conventional way with this. Cheers, Simon. - Original Message - From: Penner, Johannes johannes.pen...@mfn-berlin.de To:

Re: [R] access to the current element of lapply

2009-05-13 Thread Marc Schwartz
On May 13, 2009, at 9:12 AM, Martial Sankar wrote: Dear All, I would like to use the 'split' function on the dataframe elements contained in a list L. For example : (df - data.frame(cbind(c(rep('A',2), rep('B',2)), rep(1:4 X1 X2 1 A 1 2 A 2 3 B 3 4 B 4 (L-split(df,

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread Simon Pickett
can you provide reproducible code please? even a fake example would help. I would 1) set up a loop to read in each file from a directory 2) inside the loop chop up/ aggregate the data, each file in turn and spit each new aggreagated file out to a directory using write.table(). This will

Re: [R] name siz ein cluster

2009-05-13 Thread Penner, Johannes
I tried for example: Plot(mycluster, font=2) But this changes only the font size of the y-axis. Regards Johannes -- Project Coordinator BIOTA West Amphibians Museum of Natural History Dep. of Research (Herpetology) Invalidenstrasse 43 D-10115 Berlin Tel: +49 (0)30 2093 8708 Fax: +49 (0)30

Re: [R] where does the null come from?

2009-05-13 Thread Gabor Grothendieck
out - apply(m, 1, cat, '\n') 1 3 2 4 out NULL On Wed, May 13, 2009 at 5:23 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote:    m = matrix(1:4, 2)    apply(m, 1, cat, '\n')    # 1 2    # 3 4    # NULL why the null? vQ

[R] Histogram + % of cases for a given criteria

2009-05-13 Thread S. Nunes
Hi all, I am doing some explorations using a dataset with the following structure (id, value, flag). For instance: a, 2.2, 1 b, 3.0, 1 c, 2.9, 0 d, 3.1, 1 ... I have plotted a standard histogram using a simple command like: hist(data$value) My question: I would like to superimpose a line

[R] Histogram + % of cases for a given criteria

2009-05-13 Thread S. Nunes
Hi all, I am doing some explorations using a dataset with the following structure (id, value, flag). For instance: a, 2.2, 1 b, 3.0, 1 c, 2.9, 0 d, 3.1, 1 ... I have plotted a standard histogram using a simple command like: hist(data$value) My question: I would like to superimpose a line

Re: [R] where does the null come from?

2009-05-13 Thread Ted Harding
On 13-May-09 14:43:17, Gabor Grothendieck wrote: out - apply(m, 1, cat, '\n') 1 3 2 4 out NULL Or, more explicitly, from ?cat : Value: None (invisible 'NULL'). Ted. On Wed, May 13, 2009 at 5:23 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: _ _m =

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread Liaw, Andy
A few points to consider: - If all the data are numeric, then use matrices instead of data frames. - With either data frames or matrices, there is no way (that I'm aware of anyway) in R to stack them without making at least one copy in memory. - Since none of the files has a header row, I would

[R] Simulation

2009-05-13 Thread Debbie Zhang
Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed? (Since I dont want to do rnorm(100,0,1) in R for

[R] Problems with randomly generating samples

2009-05-13 Thread Debbie Zhang
Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed? (Since I dont want to do rnorm(100,0,1) in R for 1000

Re: [R] Simulation

2009-05-13 Thread Gábor Csárdi
On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang debbie0...@hotmail.com wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 1000 samples of size n=100, with a N(0,1)

Re: [R] Problems with randomly generating samples

2009-05-13 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Debbie Zhang Sent: Wednesday, May 13, 2009 8:18 AM To: r-help@r-project.org Subject: [R] Problems with randomly generating samples Dear R users, Can anyone please tell me

Re: [R] Simulation

2009-05-13 Thread Dimitris Rizopoulos
what about putting in a matrix, e.g., matrix(rnorm(1000*100), 1000, 100) I hope it helps. Best, Dimitris Debbie Zhang wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate

Re: [R] Simulation

2009-05-13 Thread Mike Lawrence
If you want k samples of size n, why generate k*n samples and put them in a k-by-n matrix where you can do what you want to each sample: k = 10 n = 100 x=matrix(rnorm(k*n),k,n) rowMeans(x) If you need to do more complex things to each sample and if k is large enough that you don't want the

Re: [R] limits

2009-05-13 Thread Mike Prager
Uwe Ligges lig...@statistik.tu-dortmund.de wrote: So you want some software that can do symbolic calculations? In that case use other software. R is designed for numerical analyses. In particular, if you are looking for good free software, you might try Maxima. -- Mike Prager, NOAA,

Re: [R] Simulation

2009-05-13 Thread Barry Rowlingson
On Wed, May 13, 2009 at 4:26 PM, Gábor Csárdi csa...@rmki.kfki.hu wrote: On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang debbie0...@hotmail.com wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example,

Re: [R] Simulation

2009-05-13 Thread Jorge Ivan Velez
Dear Debbie, Here are two options: # Parameters N - 1000 n - 100 # Option 1 mys - replicate(N, rnorm(n)) mys # Option 2 mys2 - matrix(rnorm(N*n),ncol=N) mys2 HTH, Jorge On Wed, May 13, 2009 at 11:13 AM, Debbie Zhang debbie0...@hotmail.comwrote: Dear R users, Can anyone please tell me

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Dana Sevak
To all of you who answered me: Thank you so much! Each approach taught me something new and I really appreciate your help! Best regards, Dana Sevak __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Problems with randomly generating samples

2009-05-13 Thread Ted Harding
On 13-May-09 15:18:05, Debbie Zhang wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed? (Since I

Re: [R] Simulation

2009-05-13 Thread Linlin Yan
Does every 100 numbers in rnorm(100 * 1000, 0, 1) have the N(0,1) distribution? On Wed, May 13, 2009 at 11:13 PM, Debbie Zhang debbie0...@hotmail.com wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For

[R] ode first step

2009-05-13 Thread Benoit Boulinguiez
Hi all, I try to assess the parameters (K1,K2) of a model that describes the adsorption of a molecule onto on adsorbent. equation: dq/dt = K1*C*(qm-q)-K2*q I know the value of 'qm' and I experimentally measure the variables 'q', 'C', and the time 't'. t C q 1 0

Re: [R] limits

2009-05-13 Thread Gabor Grothendieck
Try the rSymPy or Ryacas packages. In the rSymPy code below the var command defines x as symbolic to sympy and then we perform the computation: library(rSymPy) Loading required package: rJava sympy(var('x')) [1] x sympy(limit(x*x + x + 2, x, 2)) [1] 8 Or using devel version define x as

[R] Centering R output in Sweave/LaTeX

2009-05-13 Thread Jean-Louis Abitbol
Good Day to All, When sweaving the following: \begin{table} \centering echo=FALSE= ftable(ifmtm$type, ifmtm$gender, ifmtm$marche , ifmtm$nfic, dnn=c(Type,Gender,Ambulant,Visit)) @ \caption{Four-way cross-tabulation on all data} \label{tab:crosstab} \end{table} the output of ftable is not

Re: [R] Simulation

2009-05-13 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: On Wed, May 13, 2009 at 4:26 PM, Gábor Csárdi csa...@rmki.kfki.hu wrote: On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang debbie0...@hotmail.com wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain

Re: [R] ode first step

2009-05-13 Thread Dieter Menne
Benoit Boulinguiez benoit.boulinguiez at ensc-rennes.fr writes: I try to assess the parameters (K1,K2) of a model that describes the adsorption of a molecule onto on adsorbent. equation: dq/dt = K1*C*(qm-q)-K2*q I know the value of 'qm' and I experimentally measure the variables 'q',

Re: [R] Looking for a quick way to combine rows in a matrix

2009-05-13 Thread Chris Stubben
You can automate this step key[key == AT] - TA ## create a function to reverse a string -- see strsplit help page for this strReverse function reverse - function(x) sapply(lapply(strsplit(x, NULL), rev), paste, collapse=) key - rownames(a) # combine rownames with reverse (rownames) n-cbind(key,

[R] Anova

2009-05-13 Thread stephen sefick
melt.updn - structure(list(date = structure(c(11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, 13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, 13149), class = Date), variable = structure(c(1L, 1L, 1L, 1L,

Re: [R] Multiple plot margins

2009-05-13 Thread Andre Nathan
On Wed, 2009-05-13 at 11:22 +0200, Uwe Ligges wrote: If not, example: par(mfrow = c(2,3), mar = c(0,0,0,0), oma = c(5,5,0,0), xpd=NA) plot(1, xaxt=n, xlab=, ylab=A) plot(1, xaxt=n, yaxt=n, xlab=, ylab=) plot(1, xaxt=n, yaxt=n, xlab=, ylab=) plot(1, xlab=I, ylab=B) plot(1, xlab=II, ylab=,

[R] Calling R from .net environment

2009-05-13 Thread Arun Kumar Saha
Hi, Currently I am a .net programmer and would like to use R for my statistical computations engine. I already have installed RServer250.exe so that I could call R from my .net programming environment, however unfortunately, i could not be able to find RServer250.exe in the R-(D) COM Interface

Re: [R] Simulation

2009-05-13 Thread Barry Rowlingson
On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Barry Rowlingson wrote:  Soln - for loop:   z=list()   for(i in 1:1000){z[[i]]=rnorm(100,0,1)} now inspect the individual bits:   hist(z[[1]])   hist(z[[545]]) If that's the problem, then I

Re: [R] Anova

2009-05-13 Thread Gavin Simpson
On Wed, 2009-05-13 at 12:43 -0400, stephen sefick wrote: melt.updn - structure(list(date = structure(c(11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, 13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057,

[R] Checking a (new) package - examples require other package functions

2009-05-13 Thread Rebecca Sela
I am creating an R package. I ran R CMD check on the package, and everything passed until it tried to run the examples. Then, the result was: * checking examples ... ERROR Running examples in REEMtree-Ex.R failed. The error most likely occurred in: ### * AutoCorrelationLRtest

[R] replace() help

2009-05-13 Thread Crosby, Jacy R
Can anyone see what I'm doing wrong here (highlighted below)? This is driving me crazy... probably a ')' or something equally moronic... genw1[,1] A2 A3 A5 A7 A9 A00010 A00012 A00013 A00014 A00015 A00017 A00018 A00019 A00021 A00023 A00024 CC CC CC CC CC

Re: [R] Calling R from .net environment

2009-05-13 Thread Hutchinson,David [PYR]
Take a look at this article on CodeProject: http://www.codeproject.com/KB/cs/RtoCSharp.aspx Cheers, Dave -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Arun Kumar Saha Sent: Wednesday, May 13, 2009 10:33 AM To:

[R] Mann-Kendall test

2009-05-13 Thread Rafael Moral
Dear useRs, I've been trying to run a Mann-Kendall test in my data in order to detect trends. I studied the examples given at the Kendall package and I can understand pretty well how it works on time-series data. However, my data consists of values in different sites per year, as I display

Re: [R] Multiple plot margins

2009-05-13 Thread Greg Snow
Here is a response to almost exactly the same question from a couple of weeks ago: http://finzi.psych.upenn.edu/R/Rhelp08/2009-April/196967.html -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message-

[R] simple anova question

2009-05-13 Thread AllenL
Dear R group, Simple anova question: I am attempting to recreate a figure (from chapter 10 of Mordern Statistics for the Life Sciences, chapter 10, figure 10.8). It is an interaction diagram plotting BYIELD (continuous) as a function of BSPACING (categorical) with different lines/colours for

  1   2   >