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

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

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

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

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

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

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

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

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

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

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

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

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

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

[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

[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

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

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

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

Re: [R] Puzzle

2010-08-26 Thread Jeff Newmiller
Look for a vectorized solution such as ?table or ?aggregate to obtain a list of combination counts, followed by logical indexing or ?subset to get a set of valid combinations, and then use ?sample to get your random selections of locations/surveyors and then process only those combinations from

[R] non-linear plot parameters

2010-08-26 Thread Marlin Keith Cox
I need the parameters estimated for a non-linear equation, an example of the data is below. rm(list=ls()) Time<-c( 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8) Level<-c( 100, 110, 90, 95, 87, 60, 65, 61, 55, 57, 40, 41, 50, 47, 44, 44, 42,

Re: [R] Data Manipulations and SQL

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 1:18 PM, stephenb wrote: > is it possible to open a channel to a data frame in the default environment? > there are cases when using a sql update statement is the simplest > alternative, so instead of dumping the df and then updating and then > reimporting it I would like t

[R] anova for plm objects

2010-08-26 Thread Roberto Patuelli
Dear All, I'm looking to perform an ANOVA between two nested panel fixed effects models. I tried with anova, as well as with waldtest. anova tells me there is no method available for plm objects, while waldtest tells me my models are not nested. I think they are instead. The difference between

Re: [R] Data Manipulations and SQL

2010-08-26 Thread stephenb
Greetings Gabor, is it possible to open a channel to a data frame in the default environment? there are cases when using a sql update statement is the simplest alternative, so instead of dumping the df and then updating and then reimporting it I would like to update the df directly in R. Thank y

Re: [R] Problem with clusterCall, "Error in checkForRemoteErrors(lapply(cl, recvResult)) : "

2010-08-26 Thread telm8
Did anyone manage to have a look at this? I have now tried foreach with doMC backen and multicore, but still no luck. If someone can help that would be much appreciated! -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-clusterCall-Error-in-checkForRemoteErrors-lapply-c

Re: [R] reliability of R-Forge?

2010-08-26 Thread Marc Schwartz
On Aug 26, 2010, at 11:01 AM, Dirk Eddelbuettel wrote: > > On 26 August 2010 at 11:28, R P Herrold wrote: > | On Thu, 26 Aug 2010, Gavin Simpson wrote: > | > | > On Thu, 2010-08-26 at 02:30 -0400, David Kane wrote: > | >> How reliable is R-Forge? http://r-forge.r-project.org/ > | >> > | >> It is

Re: [R] Quick GREP challenge

2010-08-26 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Shvorob > Sent: Thursday, August 26, 2010 3:16 AM > To: r-help@r-project.org > Subject: [R] Quick GREP challeng

Re: [R] Random slopes in lmer

2010-08-26 Thread Darin A. England
I'm sure this has appeared before on this list, but the biggest help to me has been: "Gelman and Hill", Data Analysis and Regression Using Multilevel/Hierarchical Models, which contains clear explanations and the R code to go along. Also check out http://lme4.r-forge.r-project.org/book/ Looking

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

2010-08-26 Thread Martin Morgan
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,...) callGeneric(x,un

Re: [R] reliability of R-Forge?

2010-08-26 Thread R P Herrold
On Thu, 26 Aug 2010, Dirk Eddelbuettel wrote: On 26 August 2010 at 11:28, R P Herrold wrote: | Is anyone aware of explanations, other than a release process | that does not require unique versioning of differing content? | [it seems pretty basic to me that a 'receiver' of new content | could

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread S Ellison
try lapply(df, class) Steve E On Thu, Aug 26, 2010 at 4:31 PM, Daniel Brewer wrote: > Hello, > > Is there a simple way to get the class type for each column of a > data.frame? I am in the situation where I would like to get all the > columns of a data.frame that are factors. > > I have tried:

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread Barry Rowlingson
On Thu, Aug 26, 2010 at 4:44 PM, Marc Schwartz wrote: >> sapply(iris, class) > Sepal.Length  Sepal.Width Petal.Length  Petal.Width      Species >   "numeric"    "numeric"    "numeric"    "numeric"     "factor" Note that comparing the result of class(foo) is a bad way of telling if something is

Re: [R] mailing list

2010-08-26 Thread Sarah Goslee
Certainly. The link at the bottom of each and every email to this list has the web address at which you may do so. For your convenience: https://stat.ethz.ch/mailman/listinfo/r-help Sarah On Thu, Aug 26, 2010 at 9:05 AM, Sonia Spirling wrote: > Hello, > > I was wondering if I could be taken off

Re: [R] Random slopes in lmer

2010-08-26 Thread Bert Gunter
??? You were provided exactly what you requested. I think you either need to read up on what random effects models mean or more clearly communicate what YOU mean. (It's unclear to me, anyway). -- Bert Gunter Genentech Nonclinical Statistics On Thu, Aug 26, 2010 at 8:57 AM, Samantha Patrick wrot

Re: [R] Puzzle

2010-08-26 Thread Hans W Borchers
Ben Holt bio.ku.dk> writes: > I have data similar to this: > > Location Surveyor Result > A1 83 > A2 76 > A3 45 > B1 71 > B4 67 > C2 23 > C5 12 > D3 34 > E4

[R] mailing list

2010-08-26 Thread Sonia Spirling
Hello, I was wondering if I could be taken off the list to get emails? Thanks Sonia [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://

Re: [R] equalize function with zero and convert it

2010-08-26 Thread Immanuel Seeger
Thanks, but my problem is that I have my formulas in functions. How can I do that for functions or e.g. for the body(Df) below? And: How can I refer to the first solution of expression? Thanks a lot! -Ursprüngliche Nachricht- Von: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Gesend

Re: [R] Quick GREP challenge

2010-08-26 Thread Dimitri Shvorob
Many thanks! -- View this message in context: http://r.789695.n4.nabble.com/Quick-GREP-challenge-tp2339486p2339818.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 11:31 AM, Daniel Brewer wrote: > Hello, > > Is there a simple way to get the class type for each column of a > data.frame?  I am in the situation where I would like to get all the > columns of a data.frame that are factors. > > I have tried: > apply(df,2,class) > but all th

Re: [R] reliability of R-Forge?

2010-08-26 Thread Dirk Eddelbuettel
On 26 August 2010 at 11:28, R P Herrold wrote: | On Thu, 26 Aug 2010, Gavin Simpson wrote: | | > On Thu, 2010-08-26 at 02:30 -0400, David Kane wrote: | >> How reliable is R-Forge? http://r-forge.r-project.org/ | >> | >> It is down now (for me). Reporting "R-Forge Could Not Connect to Database: "

Re: [R] Random slopes in lmer

2010-08-26 Thread Samantha Patrick
Hi Thanks for your help - however if I have a model of: mod1<-lmer(B~ A+C+(A|bird), family=quasibinomial) coef then gives me an individual slope for factors A and C. However the random effect is only nested within factor - so I am only trying to allow the slope to vary in relation to effect

[R] R: daisy(): space allocation issue

2010-08-26 Thread Giuseppe De Vitis
Hi, Gavin Simpson wrote: > What do you want to do with the dissimilarities? Clustering. Gavin Simpson wrote: > If clustering, try the clara() function I can't because the variables are mixed (numeric and categorical) and (I suppose..) I should use "gower" distance in advance, shouldn't I?

Re: [R] daisy(): space allocation issue

2010-08-26 Thread Gavin Simpson
On Thu, 2010-08-26 at 07:35 -0700, abanero wrote: > Hi, > > I'm trying to apply the function daisy() to a data.frame 1x10 but I have > not enough space (error message: cannot allocate vector of length > 1476173280). > > I didn't imagine I was not able to work with a matrix of just 1 > obs

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread Marc Schwartz
On Aug 26, 2010, at 10:36 AM, David Winsemius wrote: > > On Aug 26, 2010, at 11:31 AM, Daniel Brewer wrote: > >> Hello, >> >> Is there a simple way to get the class type for each column of a >> data.frame? I am in the situation where I would like to get all the >> columns of a data.frame that

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

2010-08-26 Thread Niels Richard Hansen
Joris, I looked at the problem. Here is a minimal example reproducing the error 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"), func

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread Barry Rowlingson
On Thu, Aug 26, 2010 at 4:31 PM, Daniel Brewer wrote: > Hello, > > Is there a simple way to get the class type for each column of a > data.frame?  I am in the situation where I would like to get all the > columns of a data.frame that are factors. > > I have tried: > apply(df,2,class) > but all the

Re: [R] print method for str?

2010-08-26 Thread 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. It uses cat() from inside > the function and returns nothing. > > Since it is not usual in R

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread Ivan Calandra
Since a data.frame is a list, you should use lapply() or sapply(): > df <- data.frame(a=1:5, b=LETTERS[1:5]) > lapply(df, class) $a [1] "integer" $b [1] "factor" > sapply(df, class) a b "integer" "factor" HTH, Ivan Le 8/26/2010 17:31, Daniel Brewer a écrit : > Hello, > > I

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 11:31 AM, Daniel Brewer wrote: Hello, Is there a simple way to get the class type for each column of a data.frame? I am in the situation where I would like to get all the columns of a data.frame that are factors. I have tried: apply(df,2,class) but all the columns come ba

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread Erik Iverson
That's because apply works on arrays/matrices, not data.frames. It therefore coerces your data.frame to a matrix of type character, since you have factors, thus the result. You want sapply or lapply, since a data.frame is actually a list. sapply(df, class) and then to get what you want: df[sa

Re: [R] Find classes for each column of a data.frame

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 11:31 AM, Daniel Brewer wrote: Hello, Is there a simple way to get the class type for each column of a data.frame? I am in the situation where I would like to get all the columns of a data.frame that are factors. I have tried: apply(df,2,class) lapply(df, class) but a

[R] Find classes for each column of a data.frame

2010-08-26 Thread Daniel Brewer
Hello, Is there a simple way to get the class type for each column of a data.frame? I am in the situation where I would like to get all the columns of a data.frame that are factors. I have tried: apply(df,2,class) but all the columns come back as class "character". Thanks Dan --

[R] reliability of R-Forge?

2010-08-26 Thread R P Herrold
On Thu, 26 Aug 2010, Gavin Simpson wrote: On Thu, 2010-08-26 at 02:30 -0400, David Kane wrote: How reliable is R-Forge? http://r-forge.r-project.org/ It is down now (for me). Reporting "R-Forge Could Not Connect to Database: " late to chime in, so had tossed the first piece. As this relate

Re: [R] Passing data to aov

2010-08-26 Thread Bryan Hanson
A big thanks David! Eliminating the env = parent.frame() seems to fix everything. I hate it when I'm that close... I included that because from ?as.formula it seemed to be the default, but on re-read, I guess it doesn't really say that. In addition, I had included it even though it was the defau

Re: [R] Random slopes in lmer

2010-08-26 Thread Darin A. England
coef(mod1)$bird will give you a matrix with two columns. The first column is the intercept for each bird and the second column is the slope for each bird. ranef(mod1) will also give you a matrix of two columns. These represent the random effects. That is, how much the intercept (or slope) is shift

Re: [R] Passing data to aov

2010-08-26 Thread Ivan Calandra
Hi! I didn't see the toy data, my bad. I guess David's solution fixed the problem. Ivan Le 8/26/2010 16:10, Bryan Hanson a écrit : > Hi Ivan, there is toy data given in the original post. > > The object passed to aov is a matrix, it is called scores, and it is passed > via the formula that is

Re: [R] SEM : Warning : Could not compute QR decomposition of Hessian

2010-08-26 Thread John Fox
Dear Anne, > -Original Message- > From: Anne Mimet [mailto:ami...@mnhn.fr] > Sent: August-26-10 7:45 AM > To: John Fox > Cc: r-help@r-project.org > Subject: RE: [R] SEM : Warning : Could not compute QR decomposition of > Hessian > > Dear John, > > Thank a lot for your answer. Indeed, i m

Re: [R] About plot graphs

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 10:44 AM, Stephen Liu wrote: Hi folks, Following command prints 2 graphs side-by-side:- layout(matrix(1:2, nrow=1)) ?layout #Read the details for the widths and heights arguments more carefully and (as it suggests) see the examples. plot(Date,Input_No.) plot(Test01$

[R] About plot graphs

2010-08-26 Thread Stephen Liu
Hi folks, Following command prints 2 graphs side-by-side:- layout(matrix(1:2, nrow=1)) plot(Date,Input_No.) plot(Test01$Date, Test01$Input_No.) However each is a square graph I need a rectangular layout. Pls advise how to make it. TIA B.R. satimis _

[R] daisy(): space allocation issue

2010-08-26 Thread abanero
Hi, I'm trying to apply the function daisy() to a data.frame 1x10 but I have not enough space (error message: cannot allocate vector of length 1476173280). I didn't imagine I was not able to work with a matrix of just 1 observations... I have setted in Rgui --max-mem-size=2G (I'm not abl

Re: [R] Passing data to aov

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 8:47 AM, Bryan Hanson wrote: Hello Again Gurus and Lurkers: I’m trying to build a very user-friendly function which does aov without having the user type in a formula (which would be tedious in this case). The idea is to take the response from a PCA score matrix, and th

Re: [R] equalize function with zero and convert it

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 9:45 AM, Immanuel Seeger wrote: > Thanks, but my problem is that I have my formulas in functions. > How can I do that for functions or e.g. for the body(Df) below? Try this: > library(Ryacas) > Solve(deparse(body(f)), "x") [1] "Starting Yacas!" expression(list(x == -((10

Re: [R] Passing data to aov

2010-08-26 Thread Ivan Calandra
Hi, First, some toy data would have helped a lot, and that can explain why you got so few answers... Second, I have maybe some thoughts about it, not sure if this can help. The error tells you that the data passed to aov is not a matrix. In your function, you don't specify explicitly the dat

Re: [R] Quick GREP challenge

2010-08-26 Thread David Winsemius
On Aug 26, 2010, at 8:15 AM, Gabor Grothendieck wrote: On Thu, Aug 26, 2010 at 6:16 AM, Dimitri Shvorob wrote: grep("f[0-9]+=", "f1=5,f22=3,", value = T) [1] "f1=5,f22=3," How do I make the line output c("f1", "f22") instead? (Actually, c(1,22) would be even better). strapply in gsu

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

2010-08-26 Thread Joris Meys
Dear all, This problem came up initially while debugging a function, but it seems to be a more general problem of R. I hope I'm wrong, but I can't find another explanation. Let me illustrate with the raster package. For an object "RasterLayer" (which inherits from Raster), there is a method xyVal

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

2010-08-26 Thread Samuel Wuest
Hi Greg, thanks for the suggestion: I have attached some small dataset that can be used to reproduce the odd behavior of the approxfun-function. If it gets stripped off my email, it can also be downloaded at: http://bioinf.gen.tcd.ie/approx.data.Rdata Strangely, the problem seems specific to the

Re: [R] Problem with terms of the form (a >1) and subsetting of a terms object

2010-08-26 Thread peter dalgaard
On Aug 26, 2010, at 10:35 AM, Niels Richard Hansen wrote: > > > On 26/08/10 09.30, Dimitris Rizopoulos wrote: >> I think you need an I(), i.e., >> >> form <- ~ I(a > 1) - 1 > > Yes, it solves the concrete problem, but does not really answer > the question. Let me rephrase. Should the use of t

Re: [R] equalize function with zero and convert it

2010-08-26 Thread Gabor Grothendieck
On Thu, Aug 26, 2010 at 6:57 AM, Immanuel Seeger wrote: > Dear all, > I want to equalize a symbolic derivative (of a function with two > variables) with zero and convert it to a variable, e.g. x. > > I'm computing the derivative by: (found it in the archive) > library(Ryacas) > f <- function(x,y)

Re: [R] relimp

2010-08-26 Thread Ista Zahn
Hi John, I'm having some trouble sorting out your request, for the following reasons: 1) I don't know what misdist is (can't find it on CRAN or google) or why you need Rcmdr to run it. Presumably you meant mixdist? 2) relimp is not required by Rcmdr, merely suggested. Rcmdr will work fine without

[R] Passing data to aov

2010-08-26 Thread Bryan Hanson
Hello Again Gurus and Lurkers: I¹m trying to build a very user-friendly function which does aov without having the user type in a formula (which would be tedious in this case). The idea is to take the response from a PCA score matrix, and the factors from a list. A simple example is the function

  1   2   >