Re: [R] removed data is still there!

2010-09-23 Thread Prof Brian Ripley
On Thu, 23 Sep 2010, Peter Ehlers wrote: On 2010-09-21 5:51, Nikhil Kaza wrote: example(factor) iris1$Species<- factor(iris1$Species, drop=T) will get you what you need. Hmm, doesn't work for me. ?factor does not list a 'drop=' argument. I suspect iris1$Species <- [iris1$Species, drop=TR

Re: [R] empirical df, cdf and crossing points

2010-09-23 Thread Michael Bedward
Hello, Not sure about packages to suggest but some of this can be done with base stats... # Generate densities using common from, to and n args male <- rnorm(100, 80, 10) female <- rnorm(100, 60, 10) male.d <- density(male, from=0, to=150, n=1024) female.d <- density(female, from=0, to=150, n=102

[R] Solving equations involving gamma functions

2010-09-23 Thread Shant Ch
Hi, I want to find a value of n1. I used the following code but I am getting the error - Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' n=10 a_g<-(1/(n*(n-1)))*((pi/3)*(n+1)+(2*sqrt(3)*(n-2))-4*n+6) a_s<-function(n1) { t1=(n1-1)/2; (t1*(gamma(t1)/g

Re: [R] non-linear integer optimization?

2010-09-23 Thread Hans W Borchers
darckeen hotmail.com> writes: > This is an example of the type of problem, and how i'm currently using > optim() to solve it. I would classify this as an integer programming (IP) problem, it is not even non-linear, as there are no continuous variables. Your approach with optim() will not work

Re: [R] how to make point character thicker in the legend of xyplot?

2010-09-23 Thread Peter Ehlers
On 2010-09-23 17:57, array chip wrote: Yes, it does what I want. Thank you Peter! Just wondering what else grid.pars controls? not just the symbol in legend, right? John You can have a look at ?gpar (after loading package 'grid'). For example, your original request could be handled with setti

Re: [R] how to make point character thicker in the legend of xyplot?

2010-09-23 Thread array chip
Yes, it does what I want. Thank you Peter! Just wondering what else grid.pars controls? not just the symbol in legend, right? John - Original Message From: Peter Ehlers To: array chip Cc: "r-help@r-project.org" Sent: Thu, September 23, 2010 4:34:44 PM Subject: Re: [R] how to make p

Re: [R] how to make point character thicker in the legend of xyplot?

2010-09-23 Thread Peter Ehlers
On 2010-09-23 17:15, array chip wrote: Now I got point character thicker using panel.points(lwd=2), But I can't make it thicker in the legend of the plot. Here is an example: xyplot(1:10~1:10,groups=rep(1:5,2),col=1:2,pch=0:1,type='p',cex=2,panel=panel.points,lwd=3, key=list(x=0.7,y=0.2,corner=

[R] how to make point character thicker in the legend of xyplot?

2010-09-23 Thread array chip
Now I got point character thicker using panel.points(lwd=2), But I can't make it thicker in the legend of the plot. Here is an example: xyplot(1:10~1:10,groups=rep(1:5,2),col=1:2,pch=0:1,type='p',cex=2,panel=panel.points,lwd=3, key=list(x=0.7,y=0.2,corner=c(0,0),type='p', points=list(col=1:2,pc

Re: [R] how to make point character thicker in xyplot?

2010-09-23 Thread array chip
Thank you Greg. I also got it work by using panel.points (lwd=2) instead of using panel.xyplot() - Original Message From: Greg Snow To: array chip ; "r-help@r-project.org" Sent: Thu, September 23, 2010 2:48:06 PM Subject: RE: [R] how to make point character thicker in xyplot? Th

Re: [R] plotting multiple animal tracks against Date/Time

2010-09-23 Thread Gabor Grothendieck
On Thu, Sep 23, 2010 at 5:53 PM, Struve, Juliane wrote: > Hello, > > thank you very much for replying. I have tried this, but I get error > message > > "Error in .subset(x, j) : invalid subscript type 'list'" after > > z1 <- read.zoo(textConnection(Lines1), skip = 1, index = list(1, 2), FUN = > dt

Re: [R] how to make point character thicker in xyplot?

2010-09-23 Thread Greg Snow
There is probably a simpler way, but if you want full customization, look at panel.my.symbols in the TeachingDemos package. -Original Message- From: array chip Sent: Thursday, September 23, 2010 2:52 PM To: r-help@r-project.org Subject: [R] how to make point character thicker in xyplot?

[R] how to make point character thicker in xyplot?

2010-09-23 Thread array chip
Is there anyway to make plotting point character being thicker in xyplot? I mean not larger which can achieved by "cex=2", but thicker. I tried lwd=2, but it didn't work. I know "lwd" works in regular plot() not only for lines, but also for points. For example plot(1:10, lwd=2) Thanks John

Re: [R] Plotting multiple animal tracks against Date/Time

2010-09-23 Thread Jonathan Christensen
Include individual as a factor in your dataset, and use ggplot2: library(ggplot2) ggplot(aes(x=Date, y=Distance, color=Individual), data=data) + geom_line() ought to do it. Jonathan On Thu, Sep 23, 2010 at 9:31 AM, Struve, Juliane wrote: > Sorry for posting this questions twice, but my previo

Re: [R] removed data is still there!

2010-09-23 Thread Peter Ehlers
On 2010-09-21 5:51, Nikhil Kaza wrote: example(factor) iris1$Species<- factor(iris1$Species, drop=T) will get you what you need. Hmm, doesn't work for me. ?factor does not list a 'drop=' argument. -Peter Ehlers Nikhil Kaza Asst. Professor, City and Regional Planning University of North

Re: [R] help in density estimation

2010-09-23 Thread Ted Harding
There was a typo error in my code below. See the inserted correction. On 23-Sep-10 17:05:45, Ted Harding wrote: > On 23-Sep-10 16:52:09, Duncan Murdoch wrote: >> On 23/09/2010 11:42 AM, wangguojie2006 wrote: >>> b<-runif(1000,0,1) >>> f<-density(b) >> >> f is a list of things, including x value

Re: [R] Ordinal mixed model

2010-09-23 Thread David Atkins
Patrick-- One other option in addition to Thierry's suggestion, within R you might also consider the ordinal package, which handles random-intercept models. That said, if you are used to SPSS, I suspect this will be a titanic pain trying to move to R (part. if just for this one analysis...).

Re: [R] scatterplot 3d equal axis sequence length limitation

2010-09-23 Thread Duncan Murdoch
On 23/09/2010 2:10 PM, rtist wrote: I was wondering if anyone has a way out of the limitation that you must use equal length x,y, and z sequence lengths. For instance, x<-seq(1,100) y<-seq(1,100) z<-rnorm(100) scatterplot3d(z,x,y) works fine. However, if I get some results that has a different

Re: [R] help in density estimation

2010-09-23 Thread wangguojie2006
You guys are really good. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/help-in-density-estimation-tp2552264p2552484.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://st

[R] scatterplot 3d equal axis sequence length limitation

2010-09-23 Thread rtist
I was wondering if anyone has a way out of the limitation that you must use equal length x,y, and z sequence lengths. For instance, x<-seq(1,100) y<-seq(1,100) z<-rnorm(100) scatterplot3d(z,x,y) works fine. However, if I get some results that has a different y subset length, such as x<-seq(1,10

[R] Contour Plot - water bodies

2010-09-23 Thread G.ARUN KUMAR
Hi All I have been trying to plot irregular XYZ data on world / country map, where X and Y are llongitude and latitude coordinates and Z is a variable. My problem is I get contour lines over water bodies. The method I follow is:> library(akima)> library(maps)> library(mapdata)> library(gpclib)>

Re: [R] help in density estimation

2010-09-23 Thread Greg Snow
You could do: b <- runif(1, 0, 1) tmp <- density(b, from=0.5, to=0.5, n=1) tmp$y As one direct approach. You could also look at the logspline package for an alternative for density estimation that provides you with a density function (and also allows for finite domains). -- Gregory (Gre

Re: [R] plotting multiple animal tracks against Date/Time

2010-09-23 Thread Gabor Grothendieck
On Thu, Sep 23, 2010 at 9:50 AM, Struve, Juliane wrote: > Dear list, > > I would like to create a time series plot in which the paths of several > individuals are stacked above each other, with the x-axis being the total > observation period of three years ( 1.1.2004 to 31.12.2007) and the y-axi

Re: [R] merging multiple data frames

2010-09-23 Thread Steve Lianoglou
On Thu, Sep 23, 2010 at 12:18 PM, rasanpreet kaur suri wrote: > hi guys..thx for help > i have to perform a calculation > P-B/T-B > where P is the values in pdf and B is the values in bdf and T in tdf You have 69 rows in your pdf data.frame, and something like 20 rows in bdf and tdf, so my origin

Re: [R] help in density estimation

2010-09-23 Thread Ted Harding
On 23-Sep-10 16:52:09, Duncan Murdoch wrote: > On 23/09/2010 11:42 AM, wangguojie2006 wrote: >> b<-runif(1000,0,1) >> f<-density(b) > > f is a list of things, including x values where the density is > computed, > and y values for the density there. So you could do it by linear > interpolation

Re: [R] NetCDF file: adding a variable

2010-09-23 Thread David Pierce
Hi Gennadi, I think this is fixed in the latest version of the ncdf package, which you can access by going to CRAN, then 'packages', then 'ncdf', and clicking on 'URL'. Or here is a direct link: http://cirrus.ucsd.edu/~pierce/ncdf Give that a try and let me know if you still have a problem, --

Re: [R] extracting random effects from model formula

2010-09-23 Thread Darin A. England
I've found using the arm package to be very useful. require(arm) then use ranef(Full_model) and fixef(Full_model) On Wed, Sep 22, 2010 at 05:39:41PM +1000, Lorenzo Cattarino wrote: > Hi again, > > > > Sorry, probably I was not clear enough. > > > > I was wondering if there is a way in R

Re: [R] Determine area between two density plots

2010-09-23 Thread Benno Pütz
Am 23.Sep.2010 um 18:27 schrieb Ralf B: > I wonder what the best way is to access those values. I am using the > following code: > > x1 <- c(1,2,1,3,5,6,6,7,7,8) > x2 <- c(1,2,1,3,5,6,5,3,8,7) > d1 <- density(x1, na.rm = TRUE) > d2 <- density(x2, na.rm = TRUE) > plot(d1, lwd=3, main="bla") > lin

Re: [R] For loop with ifelse help

2010-09-23 Thread Pele
Hi Sayan, This is exactly what I was looking for - it worked perfectly. Many thanks!! Also, thanks to everyone else for their suggestions. Pele -- View this message in context: http://r.789695.n4.nabble.com/For-loop-with-ifelse-help-tp2550547p2552388.html Sent from the R help mailing list ar

[R] looking for a faster way to compare two columns of a matrix

2010-09-23 Thread Gustavo Carvalho
Please consider this matrix: x <- structure(c(5, 4, 3, 2, 1, 6, 3, 2, 1, 0, 3, 2, 1, 0, 0, 2, 1, 1, 0, 0, 2, 0, 0, 0, 0), .Dim = c(5L, 5L)) For each pair of columns, I want to calculate the proportion of entries different than 0 in column j (i > j) that have lower values than the entries in the s

Re: [R] help in density estimation

2010-09-23 Thread Duncan Murdoch
On 23/09/2010 11:42 AM, wangguojie2006 wrote: b<-runif(1000,0,1) f<-density(b) f is a list of things, including x values where the density is computed, and y values for the density there. So you could do it by linear interpolation using approx or approxfun. For example > b <- runif(1000,

Re: [R] plotting multiple animal tracks against Date/Time

2010-09-23 Thread Mike Rennie
By range on the y-axis, do you mean distance? It would have to be if time is on your x? Or am I misreading this? You could just plot() with the data for your first individual, and then add additional individuals after that using lines(), specifying a different colour and/or line type for each indi

[R] help in density estimation

2010-09-23 Thread wangguojie2006
Hi, guys, I'm using kernel "density" estimation. But how can I return to a density estimation for a fixed point? For example, b<-runif(1000,0,1) f<-density(b) How can I get the value of density(b) at b=0.5? Your help is extremely appreciated. Thanks. Jay -- View this message in context: ht

Re: [R] Determine area between two density plots

2010-09-23 Thread Ralf B
I wonder what the best way is to access those values. I am using the following code: x1 <- c(1,2,1,3,5,6,6,7,7,8) x2 <- c(1,2,1,3,5,6,5,3,8,7) d1 <- density(x1, na.rm = TRUE) d2 <- density(x2, na.rm = TRUE) plot(d1, lwd=3, main="bla") lines(d2, lty=2, lwd=3) d1[1] d1[2] The last two lines allow m

Re: [R] merging multiple data frames

2010-09-23 Thread rasanpreet kaur suri
hi guys..thx for help i have to perform a calculation P-B/T-B where P is the values in pdf and B is the values in bdf and T in tdf On Thu, Sep 23, 2010 at 7:49 PM, Mike Rennie wrote: > First, you might want to start by generating a new column to identify your > 'pdf" and "bdf" or whatever once

[R] Plotting multiple animal tracks against Date/Time

2010-09-23 Thread Struve, Juliane
Sorry for posting this questions twice, but my previous question was accidentally sent unfinished. Dear list, I would like to create a time series plot in which the paths of several individuals are stacked above each other, with the x-axis being the total observation period of three years ( 1

[R] plotting multiple animal tracks against Date/Time

2010-09-23 Thread Struve, Juliane
Dear list, I would like to create a time series plot in which the paths of several individuals are stacked above each other, with the x-axis being the total observation period of three years ( 1.1.2004 to 31.12.2007) and the y-axis being some defined range[min,max]. My data consist of Date/

[R] empirical df, cdf and crossing points

2010-09-23 Thread anupam
Hello, I am using survey data with two stage sampling for two sub-populations. I am looking for a package (or packages) that can do the following for a measure of weight. The sub-populations are M (male) and F (female). (1) empirical df and cdf for weight, and compare that across two sub- popula

Re: [R] How to pass a model formula as argument to with.mids

2010-09-23 Thread Bert Gunter
??? Use lm's data argument to do this, not the with() construction: > x <- 1:10 > y <- 2*x+5 +rnorm(10) > form <- formula(y~x) > class(form) [1] "formula" > lm(form) Call: lm(formula = form) Coefficients: (Intercept)x 5.7471.921 > dat <- data.frame(x=x,y=y) > rm(x,y) >

Re: [R] Prediction plot for logistic regression output

2010-09-23 Thread Ted Harding
On 23-Sep-10 15:08:06, Jay Vaughan wrote: > How do I construct a figure showing predicted value plots for the > dependent variable as a function of each explanatory variable > (separately) using the results of a logistic regression? It would also > be helpful to know how to show uncertainty in the

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

2010-09-23 Thread Bert Gunter
Are you aware that you can pass the function, itself, as an argument (R is mostly a functional programming language where language objects are first class objects). e.g > g <- function(x,fun)fun(x) > g(2,function(x)x^2) [1] 4 On Wed, Sep 22, 2010 at 4:06 PM, Jonathan Greenberg wrote: > R-hel

Re: [R] Length of vector without NA's

2010-09-23 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Joshua Wiley > Sent: Thursday, September 23, 2010 8:23 AM > To: Ralf B > Cc: r-help Mailing List > Subject: Re: [R] Length of vector without NA's > > Hi Ralf, > > The usual way

Re: [R] Prediction plot for logistic regression output

2010-09-23 Thread Dennis Murphy
Hi: Try ?termplot. HTH, Dennis On Thu, Sep 23, 2010 at 8:08 AM, Jay Vaughan wrote: > How do I construct a figure showing predicted value plots for the dependent > variable as a function of each explanatory variable (separately) using the > results of a logistic regression? It would also be hel

Re: [R] Length of vector without NA's

2010-09-23 Thread Joshua Wiley
Hi Ralf, The usual way (as others have shown you), takes advantage of the fact that the logical values TRUE and FALSE are counted as 1 and 0, respectively. is.na() returns TRUE if the value is NA, so to find how many are not NA, the result is reversed using ' ! '. Similar logic can be used to fi

Re: [R] Length of vector without NA's

2010-09-23 Thread Peter Langfelder
> this following code: > > x<-c(1,2,NA) > length(x) > > returns 3, correctly counting numbers as well as NA's. How can I > exclude NA's from this count? > sum(!is.na(x)) Peter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Length of vector without NA's

2010-09-23 Thread Dimitris Rizopoulos
try this sum(!is.na(x)) I hope it helps. Best, Dimitris On 9/23/2010 5:08 PM, Ralf B wrote: Hi, this following code: x<-c(1,2,NA) length(x) returns 3, correctly counting numbers as well as NA's. How can I exclude NA's from this count? Ralf __

Re: [R] For loop with ifelse help

2010-09-23 Thread sayan dasgupta
Hi Pele, I think this should work file1$state.sum <- rowSums(file2[file1$state,6:10],0) On Thu, Sep 23, 2010 at 7:46 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > Hi Pele, > > On Wed, Sep 22, 2010 at 12:40 PM, Pele wrote: > > > > Hi David - thanks for your suggestion, but I a

[R] Length of vector without NA's

2010-09-23 Thread Ralf B
Hi, this following code: x<-c(1,2,NA) length(x) returns 3, correctly counting numbers as well as NA's. How can I exclude NA's from this count? Ralf __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

[R] Prediction plot for logistic regression output

2010-09-23 Thread Jay Vaughan
How do I construct a figure showing predicted value plots for the dependent variable as a function of each explanatory variable (separately) using the results of a logistic regression? It would also be helpful to know how to show uncertainty in the prediction (95% CI or SE). Thanks- This emai

Re: [R] hdf-files

2010-09-23 Thread Steve Lianoglou
Hi Katrin, (don't forget to reply-all to R-help messages -- by default they are only sent to the recipient, and not back to the list). On Thu, Sep 23, 2010 at 10:03 AM, Katrin Fleischer wrote: > The error message is > > Error in hdf5load("Jan2006.HDF") : unable to open HDF file: Jan2006.HDF Dum

Re: [R] merging multiple data frames

2010-09-23 Thread Mike Rennie
First, you might want to start by generating a new column to identify your 'pdf" and "bdf" or whatever once it's merged. For the merging, see ?merge But as someone's already pointed out, it's not clear what you are trying to merge by. Also, as your example calculations show, you don't need to m

Re: [R] For loop with ifelse help

2010-09-23 Thread Steve Lianoglou
Hi Pele, On Wed, Sep 22, 2010 at 12:40 PM, Pele wrote: > > Hi David - thanks for your suggestion, but I am trying to avoid doing any > merging and sorting for this step because the real file I will be working > with has about 20 million records.  If I can get this loop  or something > similar to

Re: [R] hdf-files

2010-09-23 Thread Steve Lianoglou
Hi, On Thu, Sep 23, 2010 at 7:13 AM, Katrin Fleischer wrote: > Dear All, > > I have data in HDF file format and would like to read it into R. > I have tried the package hdf5 without success. What type of errors are you getting? > Any ideas and suggestions?? Sure, from: http://cran.r-project.or

[R] How to pass a model formula as argument to with.mids

2010-09-23 Thread Erich Studerus
Hello I would like to pass a model formula as an argument to the with.mids function from the mice package. The with.mids functon fits models to multiply imputed data sets. Here's a simple example library(mice) #Create multiple imputations on the nhanes data contained in the mice package.

Re: [R] merging multiple data frames

2010-09-23 Thread Steve Lianoglou
Hi, On Thu, Sep 23, 2010 at 9:04 AM, rasanpreet wrote: > > hi guys > i have multiple data frames which i want to  merge. > there are four of them..eg Can you provide a (correct) example of what you want your merged data.frame to look like? What column do you want to use in your data.frame to mer

Re: [R] non-linear integer optimization?

2010-09-23 Thread darckeen
This is an example of the type of problem, and how i'm currently using optim() to solve it. mydata <- runif(500,-1,1) myfunc <- function(p,d) { print(p <- floor(p)) ws <- function(i,n,x) sum(x[i-n+1]:x[i]) ws1 <- c(rep(NA,p[1]-1),sapply(p[1]:NROW(d),ws,p[1],d)) ws

Re: [R] Plotting densities

2010-09-23 Thread Mike Rennie
In your call to polygon(), include lty="dashed" or "dotted" or whatever you want your line type to look like. take a good look at all the options in ?par For everything you can customize in plots. Alternatively, Paul Murrel's R Graphics book is the best reference I know for this sort of stuff.

Re: [R] dnorm

2010-09-23 Thread Greg Snow
You need to take into account the bin width as well (hence the extra multiple you asked about), but it is simpler to just include prob=TRUE in the hist call, then you do not need to do any adjustment on the y-values of the reference distribution. -- Gregory (Greg) L. Snow Ph.D. Statistical Dat

Re: [R] Simple categorical scatter plot

2010-09-23 Thread Dennis Murphy
Hi: Evidently I misunderstood your intention, so let's try again. I tried to find a lattice solution but came up empty. I think this works instead using base graphics. The idea is to build up vectors of start points (x0, y0), endpoints (x1, y1) and the color of the segment between each pair of poi

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

2010-09-23 Thread Terry Therneau
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

[R] Odp: Plotting densities

2010-09-23 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.09.2010 15:10:04: > Hi group, > > I am currently plotting two densities using the following code: > > x1 <- c(1,2,1,3,5,6,6,7,7,8) > x2 <- c(1,2,1,3,5,6,5,7) > plot(density(x1, na.rm = TRUE)) > polygon(density(x2, na.rm = TRUE), border="blue") > >

Re: [R] Error: attempt to apply non-function

2010-09-23 Thread Duncan Murdoch
On 23/09/2010 8:54 AM, Maas James Dr (MED) wrote: This code worked fine for me, then did some cleaning up of formatting using ESS (Emacs) and now I get this error, no idea what is causing it, all the brackets/parentheses seem to be balanced. What have I done wrong? It would help a lot if yo

Re: [R] Error: attempt to apply non-function

2010-09-23 Thread peter dalgaard
On Sep 23, 2010, at 14:54 , Maas James Dr (MED) wrote: > This code worked fine for me, then did some cleaning up of formatting using > ESS (Emacs) and now I get this error, no idea what is causing it, all the > brackets/parentheses seem to be balanced. What have I done wrong? Look for ") ("

[R] Plotting densities

2010-09-23 Thread Ralf B
Hi group, I am currently plotting two densities using the following code: x1 <- c(1,2,1,3,5,6,6,7,7,8) x2 <- c(1,2,1,3,5,6,5,7) plot(density(x1, na.rm = TRUE)) polygon(density(x2, na.rm = TRUE), border="blue") However, I would like to avoid bordering the second density as it adds a nasty bottom

Re: [R] Newey West and Singular Matrix + library(sandwich)

2010-09-23 Thread Achim Zeileis
On Thu, 23 Sep 2010, ivo welch wrote: thank you, achim. I will try chol2inv. sandwich is a very nice package, but let me make some short suggestions. I am not a good econometrician, so I do not know what prewhitening is, In general it means, that you do not look at a (typically multivariate

[R] merging multiple data frames

2010-09-23 Thread rasanpreet
hi guys i have multiple data frames which i want to merge. there are four of them..eg pdf SampleID UVDose_J RepairHours Day_0 Day_45 Day_90 1SDM001 1.0 3 485.612 465.142 490.873 2SDM001 1.0 3 503.658 457.863 487.783 3SDM001 1.0 2 533.1

Re: [R] problem opening pdf device on Windows 7

2010-09-23 Thread anupam
Peter Dalgaard gmail.com> writes: > > Then I tried: > > > >> pdf() > > Error in pdf() : unable to start device pdf > > In addition: Warning message: > > In pdf() : cannot open 'pdf' file argument 'Rplots.pdf' > > And your working directory is writable for you? Otherwise, "Change dir" > from the

[R] hdf files

2010-09-23 Thread Katrin Fleischer
Dear All, I want to upload data in HDF-file format into R. I have tried the package 'hdf5' without success. I presume that my files are in the hdf4 format and therefore are not readable with this package. I understand that its possible to convert hdf4 into hdf5 format using C, but I was wonde

[R] Error: attempt to apply non-function

2010-09-23 Thread Maas James Dr (MED)
This code worked fine for me, then did some cleaning up of formatting using ESS (Emacs) and now I get this error, no idea what is causing it, all the brackets/parentheses seem to be balanced. What have I done wrong? Thanks Jim p0.trial01 <- 0.25 TruOR01 <- 0.80 num.patients.01 <- 50 num.tri

Re: [R] Newey West and Singular Matrix + library(sandwich)

2010-09-23 Thread ivo welch
thank you, achim. I will try chol2inv. sandwich is a very nice package, but let me make some short suggestions. I am not a good econometrician, so I do not know what prewhitening is, and the vignette did not explain it. "?coeftest" did not work after I loaded the library. automatic bandwidth s

[R] Fitting to a sum

2010-09-23 Thread pj-uk
I've run into a problem with a fitting procedure I would like R to solve for me. Basically I have to fit some data to an equation which includes a sum within the formula e.g. Y(x;a,b,c) = f_i(x;a,b,c_i) + m*x where a,b are unknown and f_i(x) is the sum of another function over a known interval i

[R] NetCDF file: adding a variable

2010-09-23 Thread Gennadi Lessin
I am trying to create a NetCDF file with bathymetry (a matrix) and then to add a grid type (an integer) as variables. This is the relevant part of the code: library(ncdf) wfile="my_file.nc" msv=-10 grdtp=2 # Dimensions d1=dim.def.ncdf("lon","degrees",as.double(lon)) d2=dim.def.ncdf("lat","degrees

Re: [R] Simple categorical scatter plot

2010-09-23 Thread Jim Lemon
On 09/23/2010 09:38 PM, Richard DeVenezia wrote: New to R. I am trying to create a simple xy plot wherein the line segment color is determined by a categorical column The following does not change colors for me, probably because I don't quite have a handle on either functions or value mapping s

Re: [R] Simple categorical scatter plot

2010-09-23 Thread Dennis Murphy
Hi: time <- c(1, 2, 3, 7,10,11,14,16,20) pressure <- c(0,10,20,20,50,18,60,65,90) status <- c(0, 0, 1, 1, 1, 0, 3, 3, 3) # You want to combine the vectors into a data frame instead # of concatenating them into one long vector. df <- data.frame(time, pressure, status) df time pressure stat

[R] local linear and local constant kernel regression with np

2010-09-23 Thread Philipp Kunze
Hi there, I ran into a weird problem using the np-package doing some local linear kernel regression. Whenever I run the function "npregbw(...)" with the option "regtype=ll" (local linear modelling), my optimal bandwidth is supposed to be 1278946. This is kind of funny, because my regressor data (1

Re: [R] Simple categorical scatter plot

2010-09-23 Thread Michael Bedward
Something like this ? time <- c(1, 2, 3, 7,10,11,14,16,20) pressure <- c(0,10,20,20,50,18,60,65,90) status <- c(0, 0, 1, 1, 1, 0, 3, 3, 3) statusColor <- c("green", "orange", "pink", "red") plot(time, pressure) for (i in 2:length(time)) lines(time[(i-1):i], pressure[(i-1):i], col=statusColo

[R] Odp: Merging two data sets

2010-09-23 Thread Petr PIKAL
Hi ?merge see all.x, all.y parameters Regards Petr r-help-boun...@r-project.org napsal dne 23.09.2010 13:59:18: > Greetings > I need to merge two data sets. The first data set contains information > on individual organisms roosting in clusters,e.g., cluster one has 5 > individuals: 3 fe

[R] Odp: Simple categorical scatter plot

2010-09-23 Thread Petr PIKAL
Hi I am not sure but you probably need to use segments. ?segments AFAIK for line there is only one colour for whole line possible. and in your function statusColor you shall not use if but ifelse or better statusColor <- function (x) { c("green","orange","pink","red")[x+1] } based on fact

[R] Merging two data sets

2010-09-23 Thread Kurt_Helf
Greetings I need to merge two data sets. The first data set contains information on individual organisms roosting in clusters,e.g., cluster one has 5 individuals: 3 females, two males, and one juvenile and so on for hundreds of clusters. The second data set contains temperature data on each o

Re: [R] referencing last row in a column

2010-09-23 Thread Petr PIKAL
Hi the other option to get last item is tail(pheno.dt$year,1) Regards Petr r-help-boun...@r-project.org napsal dne 23.09.2010 12:02:35: > Yes, thanks! :) > > 2010-09-23 11:55, Ivan Calandra skrev: > >Hi, > > xlim and ylim should be given the extremes only: > > > > plot(x,y, xlim=c(pheno.d

[R] Simple categorical scatter plot

2010-09-23 Thread Richard DeVenezia
New to R. I am trying to create a simple xy plot wherein the line segment color is determined by a categorical column The following does not change colors for me, probably because I don't quite have a handle on either functions or value mapping syntax. -- time <- c(1, 2, 3, 7,10,11,14

[R] hdf-files

2010-09-23 Thread Katrin Fleischer
Dear All, I have data in HDF file format and would like to read it into R. I have tried the package hdf5 without success. Any ideas and suggestions?? Kind regards, Katrin -- Katrin Fleischer Vrije Universiteit Amsterdam Faculty of Earth and Life Sciences Subdepartment Hydrolgy and Geo-Environm

Re: [R] Creating table from data frame

2010-09-23 Thread ZeMajik
That's golden Henrique, thanks a lot! Worked like a charm even with large datasets. On Tue, Sep 21, 2010 at 2:56 PM, Henrique Dallazuanna wrote: > Try this: > > d <- data.frame(A = letters[1:10], B = sample(letters[11:20]), C = > sample(10)) > xtabs(C ~ A + B, d) > > On Tue, Sep 21, 2010 at 8:39

Re: [R] Web forum - should I make one?

2010-09-23 Thread Siri Bjoner
Siterer "Yihui Xie" : lists are easier to post messages, but I really believe they have too many disadvantages, e.g. (relatively) difficult to search, dull interface, HTML not welcome (I don't like HTML in emails, though), no lively images, no code highlighting, attachments often get chopped off

Re: [R] non-linear integer optimization?

2010-09-23 Thread Hans W Borchers
darckeen hotmail.com> writes: > > 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

Re: [R] Ordinal mixed model

2010-09-23 Thread ONKELINX, Thierry
Dear Patrick, You can fit such a model with the MCMCglmm package. Have a look at the vignette of that package. install.packages("MCMCglmm") vignette("CourseNotes", package = "MCMCglmm") But I'm affraid that this will require some rockclimbing upon the learning curve if you are a R novice. HTH

Re: [R] Web forum - should I make one?: an opinion

2010-09-23 Thread Patrick Connolly
On Tue, 21-Sep-2010 at 12:55PM -0500, Vojtěch Zeisek wrote: [...] |> Well, if You think the niche is filled, never mind, but I think R |> should have an official web forum. It can be stackoverflow (then |> I'd expect links from main R pages to it) or I (or someone else) |> can create it. Still, I

[R] [R-pkgs] depmixS4 1.0-0 on CRAN & vignette/paper on jstatsoft.org

2010-09-23 Thread Ingmar Visser
depmixS4 has reached some form of maturity and therefore we have bumped its version number to 1.0-0 which is now on CRAN: http://cran.r-project.org/web/packages/depmixS4/index.html depmixS4 fits hidden (latent) Markov models of multivariate, mixed categorical and continuous data, otherwise known a

Re: [R] apply union function vectorially

2010-09-23 Thread Dennis Murphy
Hi: Look at the examples in ?Reduce HTH, Dennis On Thu, Sep 23, 2010 at 12:31 AM, statquant2 wrote: > > Thank you very much, this solve the problem, but more generally is there a > function that allow to apply a function to a list of object, applying > recursively the function to each answer..

Re: [R] referencing last row in a column

2010-09-23 Thread Jonas Josefsson
Yes, thanks! :) 2010-09-23 11:55, Ivan Calandra skrev: >Hi, > xlim and ylim should be given the extremes only: > > plot(x,y, xlim=c(pheno.dt$year[1],pheno.dt$year[nrow(pheno.dt)]), > ylim=c(50,150), xlab="Year", ylab="Julian Day") >^^

Re: [R] referencing last row in a column

2010-09-23 Thread Ivan Calandra
Hi, xlim and ylim should be given the extremes only: plot(x,y, xlim=c(pheno.dt$year[1],pheno.dt$year[nrow(pheno.dt)]), ylim=c(50,150), xlab="Year", ylab="Julian Day") ^^ ^^ Does it work now? Ivan Le 9/23/2010 11:44, fuge

Re: [R] referencing last row in a column

2010-09-23 Thread peter dalgaard
On Sep 23, 2010, at 11:44 , fugelpitch wrote: > > Sorry, but now I understand what you're doing, and it works as a stand-alone > in the console! :) > > But why doesn't it work in the xlim? You have a colon where a comma would work. BTW: Wouldn't xlim=range(pheno.dt$year) be more expedient? >

Re: [R] referencing last row in a column

2010-09-23 Thread fugelpitch
OK, got it to work now, just messed up the ","' and ":". Thank you! -- View this message in context: http://r.789695.n4.nabble.com/referencing-last-row-in-a-column-tp2551645p2551721.html Sent from the R help mailing list archive at Nabble.com. __ R-he

Re: [R] referencing last row in a column

2010-09-23 Thread fugelpitch
Sorry, but now I understand what you're doing, and it works as a stand-alone in the console! :) But why doesn't it work in the xlim? __ > pheno.dt$year[1] [1] 1877 > pheno.dt$year[nrow(pheno.dt)] [1] 1916 > plot(x,y, x

Re: [R] Doing operations by grouping variable

2010-09-23 Thread ONKELINX, Thierry
Another option for doing opertions by grouping variables is to the the plyr package. d <- data.frame(x=1:10, g1=LETTERS[rep(11:12,each=5)], g2=letters[rep(21:23,c(3,3,4))] ) library(plyr) ddply(d, c("g1", "g2"), function(z){ z$x <- z$x / max(z$x) z

Re: [R] eps file

2010-09-23 Thread Rainer Stuetz
On Thu, Sep 23, 2010 at 8:05 AM, KAYIS Seyit Ali wrote: > I need to create eps file which is the required figure format > of the journal that I want to submit a paper. I am able to > create files in pdf or wmf format but not in eps format. Is > there a way to convert pdf or wmf to eps? or alterna

[R] quantile curves

2010-09-23 Thread Aishe Brei
Dear List, I fitted a bivariate extreme value distribution to my matrix (data). Now I would like to add ‘quantile curves’ to the plot, similar to those calculated with qcbvnonpar() But I need the probability of the upper right corner instead of the lower left corner. (So that the curve

Re: [R] referencing last row in a column

2010-09-23 Thread fugelpitch
Thanks, but I have multiple entries for each year so the column reads: year 1877 1877 1877 1877 1878 1878 1878 1878 1879 1879 1879 1879 So I need to pick out the year from the last row rather than just counting rows. -- View this message in context: http://r.789695.n4.nabble.com/referencin

Re: [R] referencing last row in a column

2010-09-23 Thread Michael Bedward
You could do data$year[ nrow(data) ] On 23 September 2010 18:56, fugelpitch wrote: > > I am trying to set u a limit for my plot window according to the range of a > year column I have. > The first year in the range is just simply the first row, referred to as > data$year[1]. How can I find the la

[R] referencing last row in a column

2010-09-23 Thread fugelpitch
I am trying to set u a limit for my plot window according to the range of a year column I have. The first year in the range is just simply the first row, referred to as data$year[1]. How can I find the last row in a similar way to set the last year in the range? What I want to accomplish is the f

Re: [R] apply union function vectorially

2010-09-23 Thread statquant2
Thank you very much, this solve the problem, but more generally is there a function that allow to apply a function to a list of object, applying recursively the function to each answer... mathematically for a 2 argument function f(u,v) you would like a function g doing g(u1,u2,u3,u4,u5) =f(f(f(f

  1   2   >