[R] Determine area between two density plots

2010-09-22 Thread Ralf B
Hi group, I am creating two density plots as shown in the code below: x1 <- c(1,4,5,3,2,3,4,5,6,5,4,3,2,1,1,1,2,3) x2 <- c(1,4,5,3,5,7,4,5,6,1,1,1,2,1,1,1,2,3) plot(density(x1, na.rm = TRUE)) polygon(density(x2, na.rm = TRUE), border="blue") How can I determine the area that is covered between t

Re: [R] rcom and safearray type of data

2010-09-22 Thread Erich Neuwirth
rcom has its own mailing list. Please subscribe to this list at rcom.univie.ac.at and post your question there. On 9/21/2010 2:53 PM, Alex Bird wrote: > > Hello there, > > I started to use rcom package and there were no problems until I tried to > call some external function (method) which ret

Re: [R] Determine area between two density plots

2010-09-22 Thread David Winsemius
On Sep 22, 2010, at 4:54 PM, Ralf B wrote: Hi group, I am creating two density plots as shown in the code below: x1 <- c(1,4,5,3,2,3,4,5,6,5,4,3,2,1,1,1,2,3) x2 <- c(1,4,5,3,5,7,4,5,6,1,1,1,2,1,1,1,2,3) plot(density(x1, na.rm = TRUE)) polygon(density(x2, na.rm = TRUE), border="blue") How can

Re: [R] Determine area between two density plots

2010-09-22 Thread Peter Alspach
Tena koe Ralf If you save the results of density() x1Den <- density(x1) you get the x and y values of the line which is plotted. Similarly for x2 - you can then use these to shade the joint area and find the area. Tinkering with the arguments of density to make the x values for each the same

Re: [R] coxme AIC score and p-value mismatch??

2010-09-22 Thread Teresa Iglesias
Indeed! That is what was confusing me too. Glad you figured it out. -Teresa On Wed, Sep 22, 2010 at 7:31 AM, whoppitt [via R] < ml-node+2550409-1571116512-138...@n4.nabble.com > wrote: > I think I've figured it out, the AIC column is the IMPROVEMENT in AIC > compared to the null model. So bigger

Re: [R] Doing operations by grouping variable

2010-09-22 Thread Michael Bedward
Thanks for that terrific post Bill - I learnt a lot. One question, should this line d <- within(d, interaction(g1, g2, drop=TRUE)) be this ? d <- within(d, g1g2 <- interaction(g1, g2, drop=TRUE)) Michael On 23 September 2010 03:50, William Dunlap wrote: >> -Original Message- >> From:

Re: [R] Newey West and Singular Matrix

2010-09-22 Thread Achim Zeileis
On Wed, 22 Sep 2010, ivo welch wrote: dear R experts:  I am writing my own little newey-west standard error function, with heteroskedasticity and arbitrary x period autocorrelation corrections.  including my function in this post here may help others searching for something similar. it is worki

[R] import csv file problem

2010-09-22 Thread sisxy
Hello, i am trying to import the csv file into R . i have a file saved as csv in my desktop. My laptop is Window vista, version R is 2.10.1. then i used the code > Q<-read.csv("Q.csv",header=TRUE) then my error is Error in file(file, "rt") : cannot open the connection In addition: Warning me

Re: [R] import csv file problem

2010-09-22 Thread jim holtman
You are not in the correct directory. Use read.csv(file.choose()) so that you can interactively choose the correct location. On Wed, Sep 22, 2010 at 8:24 PM, sisxy wrote: > > Hello, i am trying to import the csv file into R . > i have a file saved as csv in my desktop. > My laptop is Window vi

Re: [R] import csv file problem

2010-09-22 Thread Erik Iverson
On 09/22/2010 07:24 PM, sisxy wrote: Hello, i am trying to import the csv file into R . i have a file saved as csv in my desktop. My laptop is Window vista, version R is 2.10.1. then i used the code Q<-read.csv("Q.csv",header=TRUE) R will search in its working directory for Q.csv. What is t

[R] How to change the xlab name's color?

2010-09-22 Thread tooblue
What I want is different colors corresponding to the different names, which are the colors' names. -- View this message in context: http://r.789695.n4.nabble.com/How-to-change-the-xlab-name-s-color-tp2551264p2551264.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] import csv file problem

2010-09-22 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of sisxy > Sent: Wednesday, September 22, 2010 5:25 PM > To: r-help@r-project.org > Subject: [R] import csv file problem > > > Hello, i am trying to import the csv file into R . >

Re: [R] How to change the xlab name's color?

2010-09-22 Thread Bill.Venables
?par See col.lab, col.main, col.sub, &c. To see what colours are available you can use colours() (or colors() if you don't speak English). -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of tooblue Sent: Thursday, 23 September 201

Re: [R] "statistic" term in boot function

2010-09-22 Thread Jorge Ivan Velez
Hi Alfredo, Short answer is no. As en example, consider the following: # example require(boot) x <- c(4, 4, 4, 3, 2, 4, 4, 3, 6, 2) res <- boot(x, function(v, index) mean(v[index]), R = 1000) res str(res) More information can be found under ?boot (after loaging the boot package) as well a

Re: [R] "statistic" term in boot function

2010-09-22 Thread David Winsemius
On Sep 22, 2010, at 12:24 PM, alfredo wrote: Hi There, Just a question regarding the function that is specified to boot (I have read the help, the manual and online examples.). The description of boot says that the second argument of "statistic" (non parametric bootstrap) must

[R] extending survival curves past the last event using plot.survfit

2010-09-22 Thread Krambrink, Amy M
Hello, I'm using plot.survfit to plot cumulative incidence of an event. Essentially, my code boils down to: cox <-coxph(Surv(EVINF,STATUS) ~ strata(TREAT) + covariates, data=dat) surv <- survfit(cox) plot(surv,mark.time=F,fun="event") Follow-up time extends to 54 weeks, but the last e

[R] Passing a function as a parameter...

2010-09-22 Thread Jonathan Greenberg
R-helpers: If I want to pass a character name of a function TO a function, and then have that function executed, how would I do this? I want an arbitrary version of the following, where any function can be used (e.g. I don't want the if-then statement here): apply_some_function <- function(data,

Re: [R] Passing a function as a parameter...

2010-09-22 Thread Joshua Wiley
Hi, I think the easiest way is with match.fun(). For instance: apply_some_function <- function(data, function_name) { FUN <- match.fun(function_name) FUN(data) } > apply_some_function(1:10,"mean") [1] 5.5 > apply_some_function(1:10,"min") [1] 1 Cheers, Josh On Wed, Sep 22, 2010 at 4:06 P

Re: [R] Passing a function as a parameter...

2010-09-22 Thread Liaw, Andy
One possibility: R> f = function(x, f) eval(as.call(list(as.name(f), x))) R> f(1:10, "mean") [1] 5.5 R> f(1:10, "max") [1] 10 Andy From: Jonathan Greenberg > R-helpers: > > If I want to pass a character name of a function TO a > function, and then > have that function executed, how would I do

[R] randomForest - PartialPlot - reg

2010-09-22 Thread Vijayan Padmanabhan
Dear R Group I am not sure if this is the right forum to raise this query, but i would rather give it a try and aim for reaching the right person who might be a part of this group who can help. I have a query on interpretation of PartialPlot in package randomForest. In my earlier queries in thi

Re: [R] extending survival curves past the last event using plot.survfit

2010-09-22 Thread David Winsemius
On Sep 22, 2010, at 8:15 PM, Krambrink, Amy M wrote: Hello, I'm using plot.survfit to plot cumulative incidence of an event. Essentially, my code boils down to: cox <-coxph(Surv(EVINF,STATUS) ~ strata(TREAT) + covariates, data=dat) surv <- survfit(cox) plot(surv,mark.time=F,fun="event")

Re: [R] Problem with outer()

2010-09-22 Thread Christofer Bogaso
Thanks Petr for your input. As you correctly said to make the function vectorize, I have done it and it is working fine: > fff=Vectorize(function(x,y) { +AA <- sign(x) +BB <- sign(y) +CC <- abs(y) +DD1

[R] accumulation curves

2010-09-22 Thread Kyran Staunton
Hi, I am trying to fit a logarithmic trendline to a scatterplot of a species accumulation curve. I've tried abline, lines, curve and scatter.smooth but none of these work. Can anyone help please, Kyran __ R-help@r-project.org mailing list https://stat

Re: [R] rcom and safearray type of data

2010-09-22 Thread Alex Bird
Thanks! Will post there. -- View this message in context: http://r.789695.n4.nabble.com/rcom-and-safearray-type-of-data-tp2548552p2551426.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.e

[R] converting NSCA HDF5 files to ASCII

2010-09-22 Thread Alex Anderson
Hi All, I am struggling with the task of converting some MODIS remotes sensed image data in HDF5 format to ASCII format. I have found oblique references to the HDF format in the help files for the packages hdf5, RnetCDF, and ncdf, but nothing that appears to read in an HDF format file and p

[R] non-linear integer optimization?

2010-09-22 Thread darckeen
Are there any packages that do non-linear integer otimization? Looked at lpSolve but i'm pretty sure it only works with linear programming and not non-linear, tried "L-BFGS-B" optim after flooring all my params, works somewhat but seems really inefficient. Anything else I should look at? -- Vie

Re: [R] import csv file problem

2010-09-22 Thread sisxy
it's work by using the read.csv(file.choose())... thanks ^^ as a beginner , what kind of the material should i learn ??i know the R tutorial actually , the code i saw from previous topic in the forum, for a code like Q<-read.csv(file="Q.csv") ...i not really understand Q in front for the read ,

Re: [R] import csv file problem

2010-09-22 Thread sisxy
Erik Iverson-3 wrote: > > On 09/22/2010 07:24 PM, sisxy wrote: >> >> > > R will search in its working directory for Q.csv. > > What is the working directory, use getwd() to > find out. > > > Thanks , by using the getwd() , i found the place that i should save in my laptop... then after i

[R] ergm

2010-09-22 Thread Iasonas Lamprianou
Dear colleagues, I have another question, which, I think cannot be answered easily by the manual. What is the effect of including both nodefactor("Gender") and nodematch("Gender",diff=TRUE)) for the same variable in the model? Judging from the output (please see below), you cant have estimates

Re: [R] accumulation curves

2010-09-22 Thread Michael Bedward
Hello Kyran, Some more details of your data would be helpful. For example, is it cumulative species count over time ? Michael On 23 September 2010 15:05, Kyran Staunton wrote: > Hi, > > I am trying to fit a logarithmic trendline to a scatterplot of a > species accumulation curve. I've tried abl

<    1   2