Re: [R] non-linear plot parameters

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 1:35 PM, Marlin Keith Cox wrote: I need the parameters estimated for a non-linear equation, an example of the data is below. # rm(list=ls())I really wish people would add comments to destructive pieces of code. Time<-c( 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 3, 3, 3, 3,

[R] sqldf syntax

2010-08-26 Thread Bond, Stephen
Please correct the following > sqldf("update esc left join forwagg on esc.ym=forwagg.Date set > esc.ri2=forwagg.N1 where esc.age=12","select * from main.esc") Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: near "left": syntax error) Thanks. Step

Re: [R] How to obtain the graph of fitted values against one variable after estimation?

2010-08-26 Thread Le Wang
Thanks, David. I did try to use predict() to obtain the graph, but it somehow looks different from the one generated by "plot" command. So, I was wondering if there is any way that I can get the one generated by "plot" so that I can compare. Thank you. Le On Wed, Aug 25, 2010 at 11:15 PM, David

Re: [R] How to obtain the graph of fitted values against one variable after estimation?

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 2:35 PM, Le Wang wrote: Thanks, David. I did try to use predict() to obtain the graph, "Try"? How? Code? ( predict() is used to obtain numbers, not to do graphing. ) but it somehow looks different from the one generated by "plot" command. I have no idea what you actu

[R] LFA package

2010-08-26 Thread David Joubert
Hello all- Just wondering if anyone has heard of a package performing latent factor analysis, similar to what is done with LatentGold. I know that PoLCA does latent class analysis, but I don't think it can accomodate latent factor models. Thanks, David Joubert Dept Criminology University of

[R] Importance of levels in a factor variable

2010-08-26 Thread Saeed Abu Nimeh
I have a dataset of multiple variables and a response. For example, > str(x) 'data.frame': 3557238 obs. of 44 variables: $ response : Factor w/ 2 levels $ var2: Factor w/5000 levels If var2 for example is a factor with 5000 levels, what is the best approach to determine which of these level

Re: [R] Looking for an image (R 64-bit on Linux 64-bit) on Amazon EC2

2010-08-26 Thread Saeed Abu Nimeh
No need to do that. They have some instances that run 64-bit ubuntu. If I remember correctly we had to install 64-bit R from the debian packages on the ubuntu instance. On Wed, Aug 25, 2010 at 6:12 PM, noclue_ wrote: > > >>> You have a 64 bit Linux?  If so... > >>>Dowload the sources > > Do you m

Re: [R] print method for str?

2010-08-26 Thread David Hajage
Exact, "efficiency", I didn't see that. Thank you very much. 2010/8/26 Gavin Simpson : > On Thu, 2010-08-26 at 10:42 +0200, David Hajage wrote: >> Hello useRs and guRus, >> >> I was trying to add the support of str() in the ascii package, and I >> realized that str() does not have a print method.

Re: [R] non-linear plot parameters

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 1:48 PM, David Winsemius wrote: On Aug 26, 2010, at 1:35 PM, Marlin Keith Cox wrote: I need the parameters estimated for a non-linear equation, an example of the data is below. # rm(list=ls())I really wish people would add comments to destructive pieces of code.

Re: [R] sqldf syntax

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 2:31 PM, Bond, Stephen wrote: > Please correct the following > >> sqldf("update esc left join forwagg  on esc.ym=forwagg.Date set >> esc.ri2=forwagg.N1 where esc.age=12","select * from main.esc") > Error in sqliteExecStatement(con, statement, bind.data) : >  RS-DBI driver:

[R] Help with ddply to eliminate a for..loop

2010-08-26 Thread Bos, Roger
I created a small example to show something that I do a lot of. "scale" data by month and return a data.frame with the output. "id" represents repeated observations over "time" and I want to scale the "slope" variable. The "out" variable shows the output I want. My for..loop does the job but is

Re: [R] accessing the attr(*, label.table) after importing from spss

2010-08-26 Thread moleps
Thx... The following seems to work. However I´m sure there is a more elegant solution to it tre<-dat b<-length(dat) attr(dat,"label.table")->a for (i in 1:b){ if(!is.null(a[[i]]) & length(levels(as.factor(dat[,i])))==length(a[[i]])) { tre[,i]<-factor(dat[,i

Re: [R] Help with ddply to eliminate a for..loop

2010-08-26 Thread Marc Schwartz
On Aug 26, 2010, at 3:33 PM, Bos, Roger wrote: > I created a small example to show something that I do a lot of. "scale" > data by month and return a data.frame with the output. "id" represents > repeated observations over "time" and I want to scale the "slope" > variable. The "out" variable sh

Re: [R] approxfun-problems (yleft and yright ignored)

2010-08-26 Thread Greg Snow
It looks like you have found a bug, I can confirm that with your data on my computer that I am getting nonsense results for some cases. I even found that when calling the function on element 164 of the input vector that I don't even get consistent results, I ran it several times and many times

Re: [R] Help with ddply to eliminate a for..loop

2010-08-26 Thread Marc Schwartz
On Aug 26, 2010, at 3:40 PM, Marc Schwartz wrote: > On Aug 26, 2010, at 3:33 PM, Bos, Roger wrote: > >> I created a small example to show something that I do a lot of. "scale" >> data by month and return a data.frame with the output. "id" represents >> repeated observations over "time" and I wa

Re: [R] Help with ddply to eliminate a for..loop

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 4:33 PM, Bos, Roger wrote: > I created a small example to show something that I do a lot of.  "scale" > data by month and return a data.frame with the output.  "id" represents > repeated observations over "time" and I want to scale the "slope" > variable.  The "out" variabl

Re: [R] Help with ddply to eliminate a for..loop

2010-08-26 Thread Ista Zahn
A ddply solution is dat.out <- ddply(dat, .(time), transform, slope = scale(slope)) but this is not faster than the loop, and slower than the ave() solution: > system.time( + for (i in 1:3) { +mat <- dat[dat$time==i, ] +outi <- data.frame(mat$time, mat$id, slope=scale(mat$slope)) +if

[R] R and MySQL

2010-08-26 Thread quant
I installed MySQL 5.0.67 and R. I installed RMySQL and added env variable MYSQL_HOME. But R still does not want to load the library. It says Error : .onLoad failed in loadNamespace() for 'RMySQL', details: call: NULL error: MYSQL_HOME was set but does not point to a directory Error: package/n

Re: [R] Passing arguments between S4 methods fails within a function:bug? example with raster package.

2010-08-26 Thread Niels Richard Hansen
On 26/08/10 18.42, Martin Morgan wrote: On 8/26/2010 8:43 AM, Niels Richard Hansen wrote: setGeneric("myplus",function(x,y,...) standardGeneric("myplus")) setMethod("myplus",c(x="numeric",y="numeric"), function(x,y,z=0) x+y+z ) setMethod("myplus",c(x="numeric",y="list"), function(x,y,...) call

Re: [R] creation package

2010-08-26 Thread Gábor Csárdi
Dear Anderson, please see http://lists.nongnu.org/archive/html/igraph-help/2007-07/msg00010.html for the solution of the 'postscript font not included' problem. Best, Gabor On Wed, Aug 25, 2010 at 11:50 PM, anderson nuel wrote: > Dear r-help, > > I took your advice into consideration and i trie

Re: [R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
The background you requested are energetic level (joules) in a group of starved fish over a time period of 45 days. Weekly, fish (n=5) were removed killed and measured for energy. This was done at three temperatures. I am comparing the rates at which the fish consume stored body energy at each o

Re: [R] approxfun-problems (yleft and yright ignored)

2010-08-26 Thread Greg Snow
OK, I think that I figured out what is going on. You have some of your x values that are very close to each other in value, but not exactly the same. If we look at how many unique x values you have we get: > length(unique(approx.data$x)) [1] 901 But inside the approxfun function the tapply fu

Re: [R] non-linear plot parameters

2010-08-26 Thread Bert Gunter
My opinions only below; consume at your own risk. On Thu, Aug 26, 2010 at 2:20 PM, Marlin Keith Cox wrote: > The background you requested are energetic level (joules) in a group of > starved fish over a time period of 45 days.  Weekly, fish (n=5) were removed > killed and measured for energy.  Th

Re: [R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
Thank you. Could you lastly help me with this error. I was trying to use a self starting function (Weibull). model<-nls(Level~ SSweibull(Time,Asym,Drop,lrc,pwr)) Error in qr.default(.swts * attr(rhs, "gradient")) : NA/NaN/Inf in foreign function call (arg 1) On Thu, Aug 26, 2010 at 1:42 PM, D

[R] Non-standard sorts on vectors

2010-08-26 Thread chipmaney
I have a dataset I need to sort: test.df<-data.frame(Zone=c("Floodplain", "Lake", "Shoreline"),Cover=c(50,60,70)) However, I don't want it sorted ascending/descending but in an order that I define via a vector: sort.v<-data.frame(c("Lake","Shoreline","Floodplain")) I realize I could probabl

Re: [R] Non-standard sorts on vectors

2010-08-26 Thread Jorge Ivan Velez
Hi Chipper, Try test.df[unlist(sort.v),] HTH, Jorge On Thu, Aug 26, 2010 at 5:59 PM, chipmaney <> wrote: > > I have a dataset I need to sort: > > test.df<-data.frame(Zone=c("Floodplain", "Lake", > "Shoreline"),Cover=c(50,60,70)) > > However, I don't want it sorted ascending/descending but in

Re: [R] Non-standard sorts on vectors

2010-08-26 Thread Phil Spector
Here's one possibility: sort.v<-c(Lake=1,Shoreline=2,Floodplain=3) test.df[order(sort.v[as.character(test.df$Zone)]),] Zone Cover 2 Lake60 3 Shoreline70 1 Floodplain50 - Phil Spector Sta

Re: [R] Again: wget parameters

2010-08-26 Thread [Ricardo Rodriguez] Your XEN ICT Team
Hi Christian! Sorry for being late. David Winsemius wrote: On Aug 18, 2010, at 2:58 PM, christiaan pauw wrote: Hi Ricardo and everybody In this old post to rhelp you say that the problem was solved but not what the sollution was. I have the same problem now. I want to read a Excel file fr

Re: [R] Non-standard sorts on vectors

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 6:10 PM, Jorge Ivan Velez wrote: Hi Chipper, Try test.df[unlist(sort.v),] That does work, and I suspect it is because data.frame converts character vectors to factors by default. So this also works: test.df[factor(c("Lake","Shoreline","Floodplain")), ] But why? I mu

Re: [R] non-linear plot parameters

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 5:20 PM, Marlin Keith Cox wrote: > The background you requested are energetic level (joules) in a group > of starved fish over a time period of 45 days. Weekly, fish (n=5) > were removed killed and measured for energy. This was done at three > temperatures. I am compa

Re: [R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
I agree. I typically do not use non-linear functions, so am seeing the "art" in describing functions of non-linear plots. One last thing. I tried to use a self-starting Weibull function with the posted data and received the following error. model<-nls(Level~ SSweibull(Time,Asym,Drop,lrc,pwr)) E

Re: [R] Importance of levels in a factor variable

2010-08-26 Thread Greg Snow
A factor with 5000 levels looks like it may be a numeric variable that was accidently coded as a factor (functions like read.table will do this if there is a non numeric character in with the numbers). If you really have a 5000 level factor, which levels can be discarded or combined is a questi

[R] Using termplot() with transformations of x

2010-08-26 Thread Peter Dunn
Hi all I was playing with termplot(), and came across what appears to be an inconsistency. It would appreciate if someone could enlighten me: > # First, generate some data: > y <- rnorm(100) > x <- runif(length(y),1,2) > # Now find the log of x: > logx <- log(x) > > # Now fit two models that a

Re: [R] Non-standard sorts on vectors

2010-08-26 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of chipmaney > Sent: Thursday, August 26, 2010 3:00 PM > To: r-help@r-project.org > Subject: [R] Non-standard sorts on vectors > > > I have a dataset I need to sort: > > test.df

Re: [R] About plot graphs

2010-08-26 Thread Greg Snow
There is a graphical parameter that controls whether a plot is square or takes up the maximum amount of room (rectangle), see ?par and look at the entry for pty. It is possible that you set pty='s' or it may be that the plot method sets it, without us knowing what type of object Date and Test0

[R] checking if a package is installed

2010-08-26 Thread pdb
Hi, I am writing a function that requires a specific package to be installed. Is there a way of checking if the package is installed and returning a TRUE / FALSE result so my function can return an appropriate error message and exit the function gracefully rather than just bombing out? I'm thi

Re: [R] checking if a package is installed

2010-08-26 Thread Jorge Ivan Velez
Hi pdb, Take a look at http://r.789695.n4.nabble.com/test-if-a-package-is-installed-td1750671.html#a1750674 HTH, Jorge On Thu, Aug 26, 2010 at 9:07 PM, pdb <> wrote: > > Hi, > > I am writing a function that requires a specific package to be installed. > > Is there a way of checking if the pac

Re: [R] checking if a package is installed

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 9:07 PM, pdb wrote: Hi, I am writing a function that requires a specific package to be installed. Is there a way of checking if the package is installed and returning a TRUE / FALSE result so my function can return an appropriate error message and exit the functio

[R] Problems loading rjags in R 2.11.0 under OS X 10.5.8

2010-08-26 Thread Ruben Garcia Berasategui
Dear list members, I'm trying to use JAGS 2.1.0 from within R but every time I try to load the rjags package I receive the following message: Loading required package: coda Loading required package: lattice Error : .onLoad failed in loadNamespace() for 'rjags', details: call: dyn.load(file, DL

Re: [R] About plot graphs

2010-08-26 Thread Stephen Liu
Hi Greg, Thanks for your advice. I'm not prepared altering the shape of the graphs to be plotted. What I'm trying to do is to pop up a rectangle layout window with following command. The command; layout(matrix(1:2, nrow=1)) pop up a square window. What I need is a rectangular window for the

Re: [R] Problems loading rjags in R 2.11.0 under OS X 10.5.8

2010-08-26 Thread Ben Bolker
Ruben Garcia Berasategui binus.ac.id> writes: > > Dear list members, > I'm trying to use JAGS 2.1.0 from within R ... Just a guess: are you using an up-to-date version of R? I think you might be picking up an older version of rjags which in turn is looking for an older version of JAGS ...

Re: [R] Problems loading rjags in R 2.11.0 under OS X 10.5.8

2010-08-26 Thread Ben Bolker
Ben Bolker gmail.com> writes: > > Ruben Garcia Berasategui binus.ac.id> writes: > > > > > Dear list members, > > I'm trying to use JAGS 2.1.0 from within R ... > Sorry, didn't see the subject line ("R 2.11.0") but still worth posting sessionInfo() ___

Re: [R] About plot graphs

2010-08-26 Thread Greg Snow
When you run any graphics command (layout in this case) and there is not a current graphics device (more technically only the null device) then a default graphics device is opened, that is what you are seeing. What you need to do instead is open the device yourself before calling layout. Which

Re: [R] About plot graphs

2010-08-26 Thread Stephen Liu
Hi Greg, Test01 was created with; > Test01=read.table(file=file.choose(), header=TRUE) the file selected was a .txt file. DayMonthMo.NumberDay_of_yearDraft_No. 1Jan11305 2Jan12159 3Jan13251 4Jan14215 .. 1Fe

Re: [R] non-linear plot parameters

2010-08-26 Thread Philippe Grosjean
On 26/08/10 19:48, David Winsemius wrote: On Aug 26, 2010, at 1:35 PM, Marlin Keith Cox wrote: I need the parameters estimated for a non-linear equation, an example of the data is below. # rm(list=ls()) I really wish people would add comments to destructive pieces of code. Time<-c( 0, 0,

Re: [R] Problems loading rjags in R 2.11.0 under OS X 10.5.8

2010-08-26 Thread Prof Brian Ripley
On Fri, 27 Aug 2010, Ruben Garcia Berasategui wrote: Dear list members, I'm trying to use JAGS 2.1.0 from within R but every time I try to load the rjags package I receive the following message: Which version of 'the rjags package' and where did you get it from? I have 2.1.0-6, installed as

Re: [R] checking if a package is installed

2010-08-26 Thread Dejian Zhao
require() does what you want. Run "?require" for details. require() returns 'FALSE' and gives a warning (rather than an error as 'library()' does by default) if the package does not exist. 'require' returns (invisibly) a logical indicating whether the required package is available. (You can c

Re: [R] checking if a package is installed

2010-08-26 Thread Prof Brian Ripley
On Thu, 26 Aug 2010, Jorge Ivan Velez wrote: Hi pdb, Take a look at http://r.789695.n4.nabble.com/test-if-a-package-is-installed-td1750671.html#a1750674 You are citing yourself with a poor solution (calling installed.packages()) -- so please don't. The help page for installed.packages in R

Re: [R] R and MySQL

2010-08-26 Thread Dejian Zhao
I am not sure whether you are working under windows. Hope the following message helps. Using the RMySQL package under Windows http://www.stat.berkeley.edu/users/spector/s133/RMySQL_windows.html On 2010-8-27 5:03, quant wrote: I installed MySQL 5.0.67 and R. I installed RMySQL and added env var

<    1   2