Re: [R] import csv file problem

2010-09-23 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 saved in the

[R] ergm

2010-09-23 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-23 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 staunto...@gmail.com wrote: Hi, I am trying to fit a logarithmic trendline to a scatterplot of a species accumulation

[R] lattice centre a diverging colour scale

2010-09-23 Thread baptiste auguie
Dear list, I'm using lattice::levelplot to plot a coloured image of 3D data. The range of the z values goes from negative to positive, but is not exactly centred around 0. I would however like to map a diverging colour scale with white falling exactly at 0, and both extremes being symmetrical in

[R] Help me pls

2010-09-23 Thread Seyit Ali KAYIS
Dear All, 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 alternatively, how can I create an eps file in R? Any help

Re: [R] accumulation curves

2010-09-23 Thread Michael Bedward
OK, assuming a trend in estimated spp richness vs log(effort) you could do this... plot(effort, richness) rich.lm - lm( richness ~ log(effort) ) smooth.effort - seq(1, 10, 0.1) # or whatever is appropriate lines( smooth.effort, predict(rich.lm, newdata=list(effort=smooth.effort)), col=red ) Is

Re: [R] Help me pls

2010-09-23 Thread Michael Bedward
The postscript function ? On 23 September 2010 17:12, Seyit Ali KAYIS ska...@selcuk.edu.tr wrote: Dear All, 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

[R] dnorm

2010-09-23 Thread Sibylle Stöckli
Dear R-users Idea: Plot a dnorm line using specific mean/sd to complete a histogram (skewed). xs:range of y-values, ys: dnorm function Problem: I expected to multiply the ys function with the sample size (n=250-300). I was wondering about a factor between 12'000 and 30'000 to match the size of

Re: [R] Help me pls

2010-09-23 Thread Michael Hannon
From: Seyit Ali KAYIS ska...@selcuk.edu.tr To: r-help@r-project.org Sent: Thu, September 23, 2010 12:12:49 AM Subject: [R] Help me pls Dear All, 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

Re: [R] dnorm

2010-09-23 Thread Jim Lemon
On 09/23/2010 05:42 PM, Sibylle Stöckli wrote: Dear R-users Idea: Plot a dnorm line using specific mean/sd to complete a histogram (skewed). xs:range of y-values, ys: dnorm function Problem: I expected to multiply the ys function with the sample size (n=250-300). I was wondering about a

Re: [R] lattice centre a diverging colour scale

2010-09-23 Thread Deepayan Sarkar
On Thu, Sep 23, 2010 at 12:33 PM, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear list, I'm using lattice::levelplot to plot a coloured image of 3D data. The range of the z values goes from negative to positive, but is not exactly centred around 0. I would however like to map a

Re: [R] lattice centre a diverging colour scale

2010-09-23 Thread baptiste Auguié
Great, I don't know how I missed that, thanks! baptiste On Sep 23, 2010, at 10:39 AM, Deepayan Sarkar wrote: On Thu, Sep 23, 2010 at 12:33 PM, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear list, I'm using lattice::levelplot to plot a coloured image of 3D data. The range of

Re: [R] accumulation curves

2010-09-23 Thread Michael Bedward
Hi Kyran, Please reply via the list - you'll get more answers that way :) My example had the data in vectors, you are using a data.frame. Try replacing the relevant bits of your code (below) with these lines and see if that helps... rich.lm ~ lm(Chao1 ~ log(N.obs), data=table1) smooth.effort -

[R] eps file

2010-09-23 Thread KAYIS Seyit Ali
Dear All,   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 alternatively, how can I create an eps file in R?  

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)

[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

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 jo...@runtimerecords.net 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].

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:

[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

Re: [R] eps file

2010-09-23 Thread Rainer Stuetz
On Thu, Sep 23, 2010 at 8:05 AM, KAYIS Seyit Ali s_a_ka...@yahoo.com 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

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] 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,

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. __

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 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,

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] 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 statqu...@gmail.com 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

[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

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

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] non-linear integer optimization?

2010-09-23 Thread Hans W Borchers
darckeen darckeen at 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

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

2010-09-23 Thread Siri Bjoner
Siterer Yihui Xie x...@yihui.name: 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

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 www...@gmail.comwrote: 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

[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

[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,

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,

[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

[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 that x

[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

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],

[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 (189

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 status

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

[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))

[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

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

[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

[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

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

2010-09-23 Thread anupam
Peter Dalgaard pdalgd at 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 File

[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

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

[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] 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 ) ( --

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

[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) However, I

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,fun=event)

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

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

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] 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)) ws2 -

Re: [R] merging multiple data frames

2010-09-23 Thread Steve Lianoglou
Hi, On Thu, Sep 23, 2010 at 9:04 AM, rasanpreet rasanpreet.k...@gmail.com 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

[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] hdf-files

2010-09-23 Thread Steve Lianoglou
Hi, On Thu, Sep 23, 2010 at 7:13 AM, Katrin Fleischer katrin.fleisc...@falw.vu.nl 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:

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 drdi...@yahoo.com 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

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

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 katrin.fleisc...@falw.vu.nl wrote: The error message is Error in hdf5load(Jan2006.HDF) : unable to open HDF

[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

[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

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 drdi...@yahoo.com wrote: Hi David - thanks for your suggestion,

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] 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-help

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

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 j...@fishsciences.net 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?

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 (as others

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

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] 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)

[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-

[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

[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 (

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 mikerenni...@gmail.com wrote: First, you might want to start by generating a new column to identify your 'pdf and bdf

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 me to

[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:

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

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 -

[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

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

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) lines(d2, lty=2,

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 to

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] 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 using

Re: [R] merging multiple data frames

2010-09-23 Thread Steve Lianoglou
On Thu, Sep 23, 2010 at 12:18 PM, rasanpreet kaur suri rasanpreet.k...@gmail.com 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

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 j.str...@imperial.ac.uk 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

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

[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,100)

[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 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

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 y

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

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 values where the

  1   2   >