Re: [R] Help about time series
Ferrari Nicolas nicolas.ferrari at insee.fr writes: : : Hello, : : When I create a ts object, I would like to get a particular value of this : time serie according to the date and not the rank. : However, it seems necessary to use the rank as if it were a simple vector. Try this: oneval - function(series, date) as.vector(window(series, date, date)) # test ser - ts(21:25, 101) oneval(ser, 102) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] GARCH, installing tserise package
Hi, there, First of all, I am not familar with the GARCH concept as well as R interface. I have three questions regarding GARCH (1,1). First, I got tseries package from CRAN. Where exactly am I supposed to install it? In my case, I copies it to C:\Program Files\R\rw2001\library. What do I need to do in order to actually install it? Second, I am not sure if I've installed it properly, but I've added garch function into my current R workspace. But, I got the following error message. x.garch - garch(x, order = c(1,1)) Error in .C(fit_garch, as.vector(x, mode = double), as.integer(n), : C function name not in DLL for package tseries I was running the following GARCH (1,1) model. n - 1100 a - c(0.01178, 0.003, 0.005) # ARCH(1) coefficients, assuming the mean is constant!! e - rnorm(n) x - double(n) v - double(n) v[1] - a[1]/(1.0-a[2]-a[3]) x[1] - rnorm(1, sd = sqrt(v[1])) v[1] [1] 0.011875 x[1] [1] 0.1037611 for(i in 2:n) { + v[i] - a[1]+a[2]*x[i-1]^2+a[3]*v[i-1] + x[i] - e[i]*sqrt(v[i]) + } x - ts(x[101:1100]) x.garch - garch(x, order = c(1,1)) Third, as for setting 'n' and 'x - ts(x[101, 1100])' What does 'n=1100' stand for? I mean, why is it 1100 in the above example? Any why does 'x - ts(x[101:1100]) ' start from 101 th to 1100? Does the function assume the 1100 periods? then, why does it start from 101 for 'ts' function? Sorry for the idiotic questions above, but they have driven me crazy. Looking forward to seeing your kind, easy to understand help. Knulp __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] RE: aggregating dates
I am probably just displaying my ignorance, but I have obviously managed to miss exactly what you are referring to. Firstly I have to thank you for making me look closer at the article. I had done so but I had obviously skipped over the Comparison table, which I would have found useful in the past. I, like many others have struggled with dates and because I use fSeries etc I have started to used POSIXct as my default way of including dates within my datasets. (That's where the table might have stopped me if I had read it the first time around) But my issue is that you say that the article tells you how to convert from an Integer into POSIXct. In case it makes a difference I think the question is how do you make 1104508800 into 2005-01-01 W. Australia Standard Time Is the answer, structure(1104508800,class = c(POSIXt,POSIXct))? Following Paul's message I tried y - 1104508800 class(y) = POSIXct y [1] 2005-01-01 W. Australia Standard Time str(y) Class 'POSIXct' num 1104508800 y - ISOdate(2005,1,1) str(y) `POSIXct', format: chr 2005-01-01 12:00:00 So checking the table in your article I tought this may shed some light on the topic newy - structure(1104508800,class = c(POSIXt,POSIXct)) newy [1] 2005-01-01 W. Australia Standard Time str(newy) `POSIXct', format: chr 2005-01-01 It's the same format as ISOdate so I assume it's the right way to do the conversion. You suggested that the simple 'class(y) = POSIXct' might fail. Since I thought that maybe plot functions might be interfered with I ran x - runif(3) y - as.POSIXct(c(2005-01-01,2005-01-02,2005-01-03)) plot(y,x) NULL y - as.numeric(as.POSIXct(c(2005-01-01,2005-01-02,2005-01-03))) class(y) = POSIXct plot(y,x) NULL The plots seemed to be both the same so I am not sure what the implications of your statement is. I hope this makes sense, because as usual the topic seems to go around in circles. It all makes complete sense and nonsense at the same time. Because rightly or wrongly it seems to me that class(y) - c(POSIXt,POSIXct) is the same thing as the structure statement. So is it just failing to include the POSIXt that is the issue. -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, 1 February 2005 11:48 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] RE: aggregating dates Paul Sorenson Paul.Sorenson at vision-bio.com writes: : : The solution I came up with myself was simply to coerce the integer back to POSIXct: : : class(ev$date) = POSIXct : : Can't say it is the right way to do it but it seem to work. That is not entirely correct, although it many cases it will work, since its also a subclass of POSIXt. The RNews article I mentioned in my original response to your query has the correct solution. : : A second related problem I haven't been able to solve as yet is how to My original response to your query already had a solution. : include incidents columns (those not : in 'x' or 'by') in an aggregate. : : names(ev): date defectnum state : : aggregate(ev$date, by=list(ev$defectnum), max) : : This returns only the date and defectnum, I also need the state. : : I tried writing my own aggregator function: : maxevent = function(events) { : events[which.max(events$date),] : } : : aggregate(ev, by=list(ev$defectnum), maxevent) : : But I get: : : Error in [.default(events, which.max(events$date), ) : : incorrect number of dimensions : : I am trying to retrieve only the rows of ev with the latest date for a given defectnum. : : cheers : : Message: 29 : Date: Mon, 31 Jan 2005 16:16:35 +1100 : From: Paul Sorenson Paul.Sorenson at vision-bio.com : Subject: [R] aggregating dates : To: r-help at stat.math.ethz.ch : Message-ID: 5E06BFED29594F4C9C5EBE230DE320C6068027CD at ewok.vsl.com.au : Content-Type: text/plain; charset=iso-8859-1 : : I have a frame which contains 3 columns: : : date defectnum state : : And I want to get the most recent state change for a given : defect number. date is POSIXct. : : I have tried: :aggregate(ev$date, by=list(ev$defectnum), max) : : Which appears to be working except that the dates seem to : come back as integers (presumably the internal representation : of POSIXct). : : When I execute max(ev$date) the result remains POSIXct. : : I have been dredging through the help among DateTimeClasses : and haven't found a function that converts these integers to : some kind of date class. Or a method for using aggregate : which doesn't perform the conversion in the first place. : : Any clues? : : __ : R-help at stat.math.ethz.ch mailing list : https://stat.ethz.ch/mailman/listinfo/r-help : PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html : :
Re: [R] RE: aggregating dates
On Tue, 1 Feb 2005, Paul Sorenson wrote: The solution I came up with myself was simply to coerce the integer back to POSIXct: class(ev$date) = POSIXct Can't say it is the right way to do it but it seem to work. It will work partially. The correct class is c(POSIXt, POSIXct). As I believe others have said, ISOdate(1970,1,1) + x is safer. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to get a table of MySQL database as a matrix variable in R
It seems that the dbReadTable() method provided by RMySQL could not get rid of the headers, neither the index column... So 1. Can I use read.table() method to get a table of MySQL database? From the help document the argument of 'file' of read.table() method could be a connection... 2. How can I obtain a matrix from the database table contains all elements except the headers and the index column? Thanks a lot. Regards, Willie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] installing R on Mac OS X
Silvia Are you talking of specific packages? Installing R from the Disk Image does not preclude building individual packages from source. As for your original error, I'm not sure what the problem is, but you are probably correct in assuming it may be a setup problem, but I can't tell for sure. Sean On Feb 1, 2005, at 3:04 AM, silvia simoni wrote: The thing is i do need the source code because i need some packages which are not available as binanary code for mac and whern i try to install them, they look for a file .o that is not there. silvia Il giorno 31/gen/05, alle 20:11, Sean Davis ha scritto: Silvia You may want to use the disk image instead. It is here (for italy): http://microarrays.unife.it/CRAN/bin/macosx/R-2.0.1.dmg Sean On Jan 31, 2005, at 1:52 PM, silvia simoni wrote: I have a problem in installing R-2.0.1, downloaded from the R web site, on mac o sx version 10.3.7. when i launch the command ./configure i get the following error message: checking for C compiler default output file name... configure: error: C compiler cannot create executables i've aleady insalled Xcode. the version of the gcc in 3.3. what can i do? thanks silvia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Rcmdr doesn't seem to work
Context: Windows XP - R 2.0.1 with the latest updated packages (including Rcmdr) I'm trying to load Rcmdr to use the 3d plots (e.g. scatter3d) but here it is what happens: library(Rcmdr) Loading required package: zoo Loading required package: strucchange Loading required package: sandwich Loading required package: relimp Loading required package: mvtnorm Loading required package: multcomp Loading required package: lmtest Loading required package: effects Loading required package: car Loading required package: abind Loading required package: rgl Error in library(package, character.only = TRUE, logical = TRUE, warn.conflicts = warn.conflicts, : 'rgl' is not a valid package -- installed 2.0.0? Error: .onLoad failed in loadNamespace for 'Rcmdr' Error in library(Rcmdr) : package/namespace load failed for 'Rcmdr' What should I do? Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to get a table of MySQL database as a matrix variable in R
On Feb 1, 2005, at 5:57 AM, Willie Y. CHEN wrote: It seems that the dbReadTable() method provided by RMySQL could not get rid of the headers, neither the index column... So You can use dbSendQuery and fetch to get your results without the index column. If you have a table with columns called col1, col2, col3, and indexcol, you could do something like: drv - dbDriver(MySQL) con - dbConnect(drv, usr, password, dbname) res - dbSendQuery(con, SELECT col1,col2,col3 from mytable) data - fetch(res, n = -1) data will now be a dataframe with columns named col1,col2,and col3. If you want it as a matrix, you can simply do: my.matrix - as.matrix(data) Alternatively, if you use dbReadTable, your result will always be a dataframe. If you want a matrix and your index column is in the first column of the dataframe, you can do: my.matrix - as.matrix(data[,-1]) 1. Can I use read.table() method to get a table of MySQL database? From the help document the argument of 'file' of read.table() method could be a connection... No, you cannot use read.table to read from a MySQL database. You could dump the table to disk as a tab-delimited text file and then read it, but that defeats the purpose of using RDBMS for data storage and retrieval 2. How can I obtain a matrix from the database table contains all elements except the headers and the index column? See above for coercing a dataframe to a matrix. Thanks a lot. Regards, Willie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rcmdr doesn't seem to work
[EMAIL PROTECTED] wrote: Context: Windows XP - R 2.0.1 with the latest updated packages (including Rcmdr) I'm trying to load Rcmdr to use the 3d plots (e.g. scatter3d) but here it is what happens: library(Rcmdr) Loading required package: zoo Loading required package: strucchange Loading required package: sandwich Loading required package: relimp Loading required package: mvtnorm Loading required package: multcomp Loading required package: lmtest Loading required package: effects Loading required package: car Loading required package: abind Loading required package: rgl Error in library(package, character.only = TRUE, logical = TRUE, warn.conflicts = warn.conflicts, : 'rgl' is not a valid package -- installed 2.0.0? Error: .onLoad failed in loadNamespace for 'Rcmdr' Error in library(Rcmdr) : package/namespace load failed for 'Rcmdr' What about installing a recent version of rgl, compiled for R-2.0.x? install.packages(rgl) should do the trick. Uwe Ligges What should I do? Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] RData loading weirdness
I've just had an interesting thing happen to one of our students. He's using R 1.9.1 on Linux, and so I dont expect bugfixes, I'm just reporting this out of interest in case anyone else has had this happen. Starting R caused a seg fault shortly after [Previously saved workspace restored]. Running R --no-restore-data worked fine so I suspected a corrupted .RData. It was 67M big, with about 400 objects - nothing extreme there. But then doing load(.RData) worked fine. There were his objects. How strange. I deleted the first 200 objects, saved the .RData, and retried. That worked, so I thought it might have been an object in the last 200 or so. So I saved them to .RData. Starting up with that worked. So, starting afresh with the original load(.RData), I saved two .RData files with each part. Quit, start again, load(part1.RData) and load(part2.RData), then quit and save. Now I had all 400-ish objects in one .RData. Time to start R and see if it can startup with it. And it did. Worked fine. So I suspect a subtle bug in reading .RData files or subtle corruption in the .RData. Most odd. Oh well, I guess I could see what R 2.x.x does with it Barry __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to get a table of MySQL database as a matrix variable in R
On Tue, 1 Feb 2005, Willie Y. CHEN wrote: It seems that the dbReadTable() method provided by RMySQL could not get rid of the headers, neither the index column... So 1. Can I use read.table() method to get a table of MySQL database? From the help document the argument of 'file' of read.table() method could be a connection... ?connection will tell you what that is: it is nothing to do with RMySQL. 2. How can I obtain a matrix from the database table contains all elements except the headers and the index column? We don't know what you have tried, but note that dbReadTable (and read.table) return data frames, not matrices, and data frames must have row names and (column) names. You probably need to research the difference between a matrix and a data frame. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rcmdr doesn't seem to work
The problem is rather that your installation of rgl is out-of-date or corrupt, as the error message says. I do not believe you do have the current rgl, and you need to get it. On Tue, 1 Feb 2005 [EMAIL PROTECTED] wrote: Context: Windows XP - R 2.0.1 with the latest updated packages (including Rcmdr) I'm trying to load Rcmdr to use the 3d plots (e.g. scatter3d) but here it is what happens: library(Rcmdr) Loading required package: zoo Loading required package: strucchange Loading required package: sandwich Loading required package: relimp Loading required package: mvtnorm Loading required package: multcomp Loading required package: lmtest Loading required package: effects Loading required package: car Loading required package: abind Loading required package: rgl Error in library(package, character.only = TRUE, logical = TRUE, warn.conflicts = warn.conflicts, : 'rgl' is not a valid package -- installed 2.0.0? Error: .onLoad failed in loadNamespace for 'Rcmdr' Error in library(Rcmdr) : package/namespace load failed for 'Rcmdr' What should I do? Try install.packages(rgl), or use the menus to install it. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] assign connections automatically
Hi all, I am trying to create a function that will open connections to all files of one type within the working directory. I've got the function to open the connections, but I am having a bugger of a time trying to get these connections named as objects in the workspace. I am at the point where I can do it outside of the function, but not inside, using assign. I'm sure I'm missing something obvious about the inherent properties of functions. #first six lines just setup for this example x-1:20 y-20:40 z-40:60 write(x, file=testx.txt) write(y, file=testy.txt) write(z, file=testz.txt) inConnect - function(){ + fn - dir(pattern=*.txt) # grab only *.txt files + fn2 - gsub('.txt', , fn) # removes the '.txt' from each string + for(i in 1:length(fn)) + assign((fn2[[i]]),file(fn[i], open=r)) + } showConnections() #currently, no connections description class mode text isopen can read can write inConnect() # run function showConnections() #the connections are now there description class mode text isopen can read can write 3 testx.txt file r text opened yesno 4 testy.txt file r text opened yesno 5 testz.txt file r text opened yesno ls() #but NOT there as objects [1] fn fn2 inConnectlast.warning [5] xyz fn - dir(pattern=*.txt) #but if I do it manually fn2 - gsub('.txt', , fn) assign((fn2[[3]]),file(fn[3], open=r)) ls() #the connection, testz, appears [1] fn fn2 inConnectlast.warning [5] testzxy z What am I missing? or is there a better way? I am using R 2.0.1 on a Windows2K box. Thanks so much! Tim Howard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] assign connections automatically
You are assigning in the frame of the function, not in the user workspace. See ?assign and try pos=1 (if that is what you intended) but it might well be better to return a list of objects. On Tue, 1 Feb 2005, Tim Howard wrote: Hi all, I am trying to create a function that will open connections to all files of one type within the working directory. I've got the function to open the connections, but I am having a bugger of a time trying to get these connections named as objects in the workspace. I am at the point where I can do it outside of the function, but not inside, using assign. I'm sure I'm missing something obvious about the inherent properties of functions. #first six lines just setup for this example x-1:20 y-20:40 z-40:60 write(x, file=testx.txt) write(y, file=testy.txt) write(z, file=testz.txt) inConnect - function(){ + fn - dir(pattern=*.txt) # grab only *.txt files + fn2 - gsub('.txt', , fn) # removes the '.txt' from each string + for(i in 1:length(fn)) + assign((fn2[[i]]),file(fn[i], open=r)) + } showConnections() #currently, no connections description class mode text isopen can read can write inConnect() # run function showConnections() #the connections are now there description class mode text isopen can read can write 3 testx.txt file r text opened yesno 4 testy.txt file r text opened yesno 5 testz.txt file r text opened yesno ls() #but NOT there as objects [1] fn fn2 inConnectlast.warning [5] xyz fn - dir(pattern=*.txt) #but if I do it manually fn2 - gsub('.txt', , fn) assign((fn2[[3]]),file(fn[3], open=r)) ls() #the connection, testz, appears [1] fn fn2 inConnectlast.warning [5] testzxy z What am I missing? or is there a better way? I am using R 2.0.1 on a Windows2K box. Thanks so much! Tim Howard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] package installation problem
Hi, I'm running R-1.9.1 and I'm unable to succesfully install packages using either 'R CMD INSTALL xxx.tar.gz' or 'install.packages(xxx). For example, if I try to install the msm package I get: R CMD INSTALL msm_0.4.1.tar.gz * Installing *source* package 'msm' ... ERROR: R_HOME ('/root/R-1.9.1') not found ERROR: installing package DESCRIPTION failed ** Removing '/usr/share/R-1.9.1/library/msm' In R I get: install.packages(msm) ... messages confirming succesful download are given here ... WARNING: ignoring environment value of R_HOME /root/R-1.9.1/bin/Rcmd: /root/R-1.9.1/bin/Rcmd: No such file or directory Delete downloaded files (y/N)? As you can see, R is under /usr/share/R-1.9.1 on my Slackware 9.1 Linux system. paste(file.path(R.home(),bin,R)) gives me /usr/share/R-1.9.1/bin/R and Sys.getenv(R_HOME) gives me /usr/share/R-1.9.1 as does 'R RHOME'. Everything seems fine, but I do not understand why it's trying to look for /root/R-1.9.1? How do I solve this problem? Any help is greatly appreciated! Maarten-Jan Kallen Faculty of Electrical Engineering, Mathematics and Computer Science Delft University of Technology Delft, the Netherlands __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error in load(dataFile, myEnv)
Dear all, I just found that some of the packages are not able to load any more, after I installed R2.0.1 in my Mac, it even affects my old R1.8 installs. It gives me errors when I load packages that contains myEnv settings. such as: RMySQL, DBI, Rggobi, etc. But others that does not require myENV is all right, like tcltk that only calls the c functions. The errors are like: Error in load(dataFile, myEnv) : unused argument(s) ( ...) Error in library(DBI) : .First.lib failed for 'DBI' I had a look at the package file that contains .First.lib, fullName - paste(package, pkgname, sep=:) myEnv - as.environment(match(fullName, search())) dataFile - file.path(libname, pkgname, R, all.rda) rm(.First.lib, envir = myEnv) load(dataFile, myEnv) I found that myEnv is not set. as the package can not be matched in search(). If I comment the line load(dataFile, myEnv), then the package is loaded without errors but there no functions is loaded at all. It probably is something trivial. Can some one help, please? ___ Zhesi He Computational Biology Laboratory, University of York York YO10 5YW, U.K. Phone: +44-(0)1904-328279 Email: [EMAIL PROTECTED] ___ [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RE: aggregating dates
The issue is just that you need to add POSIXt to the class vector to be absolutely correct. class(x) - c(POSIXt, POSIXct) is the same as structure(x, class = c(POSIXt, POSIXct)) The only reason the table used the latter was to put it in functional form rather than lvalue form. The class form that you are using does have the advantage of not manipulating the underlying representation directly. The way that class(x) - POSIXct might ail would be if there were a POSIXt method that should be applied since it would then never find it. I don't know of an actual example of this which is why I mentioned that it will mostly work anyways but its possible that there are situations where it could fail, at least in in principle. Regarding the question below on W. Australia Standard Time, POSIXct stores the datetime internally relative to GMT regardless of how you intend to use or display it (although it does have the capability of storing the time zone using the tzone attribute so it can know which time zone to operate in when there might be confusion). Also note that if you are using fBasics then fBasics does its own time zone processing using the Olsen data base and only uses POSIXct as an underlying layer for its GMT processing. Also, if you use fBasics be sure you have set your process or computer to GMT time for it to process the times correctly. Mulholland, Tom Tom.Mulholland at dpi.wa.gov.au writes: : : I am probably just displaying my ignorance, but I have obviously managed to miss exactly what you are : referring to. : : Firstly I have to thank you for making me look closer at the article. I had done so but I had obviously skipped : over the Comparison table, which I would have found useful in the past. I, like many others have struggled : with dates and because I use fSeries etc I have started to used POSIXct as my default way of including dates : within my datasets. (That's where the table might have stopped me if I had read it the first time around) : : But my issue is that you say that the article tells you how to convert from an Integer into POSIXct. In case it : makes a difference I think the question is how do you make 1104508800 into 2005-01-01 W. Australia : Standard Time : : Is the answer, structure(1104508800,class = c(POSIXt,POSIXct))? : : Following Paul's message I tried : : y - 1104508800 : class(y) = POSIXct : y : [1] 2005-01-01 W. Australia Standard Time : str(y) : Class 'POSIXct' num 1104508800 : : y - ISOdate(2005,1,1) : str(y) : `POSIXct', format: chr 2005-01-01 12:00:00 : : So checking the table in your article I tought this may shed some light on the topic : : newy - structure(1104508800,class = c(POSIXt,POSIXct)) : newy : [1] 2005-01-01 W. Australia Standard Time : str(newy) : `POSIXct', format: chr 2005-01-01 : : It's the same format as ISOdate so I assume it's the right way to do the conversion. : : You suggested that the simple 'class(y) = POSIXct' might fail. Since I thought that maybe plot functions : might be interfered with I ran : : x - runif(3) : y - as.POSIXct(c(2005-01-01,2005-01-02,2005-01-03)) : plot(y,x) : NULL : y - as.numeric(as.POSIXct(c(2005-01-01,2005-01-02,2005-01-03))) : class(y) = POSIXct : plot(y,x) : NULL : : The plots seemed to be both the same so I am not sure what the implications of your statement is. : : I hope this makes sense, because as usual the topic seems to go around in circles. It all makes complete sense : and nonsense at the same time. Because rightly or wrongly it seems to me that class(y) - : c(POSIXt,POSIXct) is the same thing as the structure statement. So is it just failing to include the : POSIXt that is the issue. : : : : -Original Message- : From: Gabor Grothendieck [mailto:ggrothendieck at myway.com] : Sent: Tuesday, 1 February 2005 11:48 AM : To: r-help at stat.math.ethz.ch : Subject: Re: [R] RE: aggregating dates : : : Paul Sorenson Paul.Sorenson at vision-bio.com writes: : : : : : The solution I came up with myself was simply to coerce the : integer back to : POSIXct: : : : : class(ev$date) = POSIXct : : : : Can't say it is the right way to do it but it seem to work. : : That is not entirely correct, although it many cases it will work, : since its also a subclass of POSIXt. : : The RNews article I mentioned in my original response to your : query has the correct solution. : : : : : A second related problem I haven't been able to solve as : yet is how to : : My original response to your query already had a solution. : : : : : include incidents columns (those not : : in 'x' or 'by') in an aggregate. : : : : names(ev): date defectnum state : : : : aggregate(ev$date, by=list(ev$defectnum), max) : : : : This returns only the date and defectnum, I also need the state. : : : : I tried writing my own aggregator function: : : maxevent = function(events) { : :
Re: [R] Rcmdr doesn't seem to work
:-- Messaggio originale -- :Date: Tue, 01 Feb 2005 12:52:14 +0100 :From: Uwe Ligges [EMAIL PROTECTED] :To: [EMAIL PROTECTED] :Cc: r-help r-help@stat.math.ethz.ch :Subject: Re: [R] Rcmdr doesn't seem to work : : :[EMAIL PROTECTED] wrote: : : Context: Windows XP - R 2.0.1 with the latest updated packages (including : Rcmdr) : : I'm trying to load Rcmdr to use the 3d plots (e.g. scatter3d) but here :it : is what happens: : : :library(Rcmdr) : : Loading required package: zoo : Loading required package: strucchange : Loading required package: sandwich : Loading required package: relimp : Loading required package: mvtnorm : Loading required package: multcomp : Loading required package: lmtest : Loading required package: effects : Loading required package: car : Loading required package: abind : Loading required package: rgl : Error in library(package, character.only = TRUE, logical = TRUE, warn.conflicts : = warn.conflicts, : : 'rgl' is not a valid package -- installed 2.0.0? : Error: .onLoad failed in loadNamespace for 'Rcmdr' : Error in library(Rcmdr) : package/namespace load failed for 'Rcmdr' : :What about installing a recent version of rgl, compiled for R-2.0.x? : :install.packages(rgl) should do the trick. : :Uwe Ligges : : Got it and now it all worksBUT I'm puzzled by the fact that I systematically update all the packages in R 2.0.1 using 'update.packages()'. Why in this case R was unable to find the obsolete versions of Rcmdr and rgl and substitued the with new ones? Thanks Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to write a new top-level Trellis/lattice function?
Hello, I am trying to write a new top level Trellis/lattice function. By top-level, I mean a function like 'xyplot', 'histogram', 'bwplot', etc. These functions all call 'trellis.skeleton', which I am unable to call; an attempt to invoke the function that does so yields the error message: - Error in do.call(trellis.skeleton, c(list(cond = cond, aspect = aspect, : couldn't find function trellis.skeleton - It seems that 'trellis.skeleton' is an internal (to lattice) function. Is this correct, and if so, what is the recommended way to develop a new top-level Trellis/lattice function? best regards, Marc Dr. Marc Paterno Fermi National Accelerator Laboratory __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Split RPMS for Fedora Core 3
I have split up the R RPMS for Fedora Core 3 into two subpackages - R and R-devel. Following the usual RPM naming convention, the basic R package is now for users, and R-devel package is for people wishing to do program development with R. This includes installing R packages from source Note that R-devel is not the development version of R, but contains the files needed for creating R packages. If you have configured up2date to automatically notify you of R updates on CRAN, then you will need to manually install R-devel to maintain the same level of functionality. At the same time, I have created a separate libRmath-devel package, which provides the Rmath.h header file and a static version of standalone Mathlib. This is an experiment, so please let me know if there are any problems. Martyn __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rcmdr doesn't seem to work
[EMAIL PROTECTED] wrote: :-- Messaggio originale -- :Date: Tue, 01 Feb 2005 12:52:14 +0100 :From: Uwe Ligges [EMAIL PROTECTED] :To: [EMAIL PROTECTED] :Cc: r-help r-help@stat.math.ethz.ch :Subject: Re: [R] Rcmdr doesn't seem to work : : :[EMAIL PROTECTED] wrote: : : Context: Windows XP - R 2.0.1 with the latest updated packages (including : Rcmdr) : : I'm trying to load Rcmdr to use the 3d plots (e.g. scatter3d) but here :it : is what happens: : : :library(Rcmdr) : : Loading required package: zoo : Loading required package: strucchange : Loading required package: sandwich : Loading required package: relimp : Loading required package: mvtnorm : Loading required package: multcomp : Loading required package: lmtest : Loading required package: effects : Loading required package: car : Loading required package: abind : Loading required package: rgl : Error in library(package, character.only = TRUE, logical = TRUE, warn.conflicts : = warn.conflicts, : : 'rgl' is not a valid package -- installed 2.0.0? : Error: .onLoad failed in loadNamespace for 'Rcmdr' : Error in library(Rcmdr) : package/namespace load failed for 'Rcmdr' : :What about installing a recent version of rgl, compiled for R-2.0.x? : :install.packages(rgl) should do the trick. : :Uwe Ligges : : Got it and now it all worksBUT I'm puzzled by the fact that I systematically update all the packages in R 2.0.1 using 'update.packages()'. Why in this case R was unable to find the obsolete versions of Rcmdr and rgl and substitued the with new ones? The package version has not changed. You need to recompile from sources when upgrading the R version - or just reinstalling the appropriate binary. R-devel's (to be R-2.1.0) update.packages() has a checkBuilt argument that is documented as follows: If 'TRUE', a package built under an earlier minor version of R is considered to be 'old'. Uwe Ligges Thanks Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Split-split plot ANOVA
Does someone out there have an example of R-code for a split-split plot ANOVA using aov or another function? The design is not balanced. I never set up one in R before and it would be nice to see an example before I tackle a very complex design I have to model. Thanks, Mike Mike Saunders Research Assistant Forest Ecosystem Research Program Department of Forest Ecosystem Sciences University of Maine Orono, ME 04469 207-581-2763 (O) 207-581-4257 (F) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] assign connections automatically
Thank you for the help! Both, env=.GlobalEnv and pos=1 do the trick. I'm embarrassed I didn't glean this from the assign help pages earlier. ?assign suggests that env is there for back compatibility so I'm going with pos. Tim Howard James Holtman try: inConnect - function(){ + fn - dir(pattern=*.txt) # grab only *.txt files + fn2 - gsub('.txt', , fn) # removes the '.txt' from each string + for(i in 1:length(fn)) + assign((fn2[[i]]),file(fn[i], open=r),env = .GlobalEnv) + } __ James HoltmanWhat is the problem you are trying to solve? Executive Technical Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] +1 (513) 723-2929 Prof Brian Ripley [EMAIL PROTECTED] 02/01/05 08:34AM You are assigning in the frame of the function, not in the user workspace. See ?assign and try pos=1 (if that is what you intended) but it might well be better to return a list of objects. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to write a new top-level Trellis/lattice function?
you can see the trellis.skeleton function using the following: library(lattice) getAnywhere(trellis.skeleton) f - getAnywhere(trellis.skeleton)[[2]][[1]] I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Marc Paterno [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, February 01, 2005 2:53 PM Subject: [R] How to write a new top-level Trellis/lattice function? Hello, I am trying to write a new top level Trellis/lattice function. By top-level, I mean a function like 'xyplot', 'histogram', 'bwplot', etc. These functions all call 'trellis.skeleton', which I am unable to call; an attempt to invoke the function that does so yields the error message: - Error in do.call(trellis.skeleton, c(list(cond = cond, aspect = aspect, : couldn't find function trellis.skeleton - It seems that 'trellis.skeleton' is an internal (to lattice) function. Is this correct, and if so, what is the recommended way to develop a new top-level Trellis/lattice function? best regards, Marc Dr. Marc Paterno Fermi National Accelerator Laboratory __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] package installation problem
I guess either R has not been installed properly, or you have two (or more) versions of R lying around... Uwe Ligges MJK wrote: Hi, I'm running R-1.9.1 and I'm unable to succesfully install packages using either 'R CMD INSTALL xxx.tar.gz' or 'install.packages(xxx). For example, if I try to install the msm package I get: R CMD INSTALL msm_0.4.1.tar.gz * Installing *source* package 'msm' ... ERROR: R_HOME ('/root/R-1.9.1') not found ERROR: installing package DESCRIPTION failed ** Removing '/usr/share/R-1.9.1/library/msm' In R I get: install.packages(msm) ... messages confirming succesful download are given here ... WARNING: ignoring environment value of R_HOME /root/R-1.9.1/bin/Rcmd: /root/R-1.9.1/bin/Rcmd: No such file or directory Delete downloaded files (y/N)? As you can see, R is under /usr/share/R-1.9.1 on my Slackware 9.1 Linux system. paste(file.path(R.home(),bin,R)) gives me /usr/share/R-1.9.1/bin/R and Sys.getenv(R_HOME) gives me /usr/share/R-1.9.1 as does 'R RHOME'. Everything seems fine, but I do not understand why it's trying to look for /root/R-1.9.1? How do I solve this problem? Any help is greatly appreciated! Maarten-Jan Kallen Faculty of Electrical Engineering, Mathematics and Computer Science Delft University of Technology Delft, the Netherlands __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] RV: problems checking a package
Dear R-listers, I have a very strange problem. I made a package (under Windows and Linux). The package passed the R CMD Check without problem. Then, I installed the package and executed a function which calls to a 'dll' mod-frailtyPenal(Surv(time,status)~sex+age+cluster(id), + n.knots=8,kappa1=1,data=kidney) mod Call: frailtyPenal(formula = Surv(time, status) ~ sex + age + cluster(id), data = kidney, n.knots = 8, kappa1 = 1) Shared Gamma Frailty model parameter estimates using a Penalized Likelihood on the hazard function coef exp(coef) se(coef) se(coef) HIH z p sex -1.73270 0.177 0.5529 0.5026 -3.134 0.0017 age 0.00812 1.008 0.0125 0.0123 0.651 0.5200 Frailty parameter, Theta: 0.499 (s.e.: 0.266 ) (s.e. HIH: 0.259 ) penalized marginal log-likelihood = -325.64 n= 76 n events= 58 n groups= 38 number of iterations: 20 However, If we try to execute the same function once again we obtain the following results mod-frailtyPenal(Surv(time,status)~sex+age+cluster(id), + n.knots=8,kappa1=1,data=kidney) mod Call: frailtyPenal(formula = Surv(time, status) ~ sex + age + cluster(id), data = kidney, n.knots = 8, kappa1 = 1) Shared Gamma Frailty model parameter estimates using a Penalized Likelihood on the hazard function coef exp(coef) se(coef) se(coef) HIH z p sex -1.74321 0.175 0.5529 0.5026 -3.153 0.0016 age 0.00613 1.006 0.0125 0.0123 0.491 0.6200 Frailty parameter, Theta: 14797011 (s.e.: 1449 ) (s.e. HIH: 1410 ) penalized marginal log-likelihood = 56.63 n= 76 n events= 58 n groups= 38 number of iterations: 351 As you can see, parameters estimates and number of iterations are not the same. In addition, the second execution takes about 10 seconds and the first one only 1 or 2. Finnally, if we try to estimate the same model once again, the PC hunks. I suspect that there is a problem with Fortran but after proving many changes I do not find it. Do someone know what it is happening? Thank you very much for any help in advance. Best Regards, Juan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sgeostat
Hi, list, I am using 'sgeostat' package by Albrecht Gebhardt and I am trying to put a correlation coefficient of some kind on the lagplots. Is there a possiblity to do so? Thanks Mahdi -- --- Mahdi Osman (PhD) E-mail: [EMAIL PROTECTED] --- GMX im TV ... Die Gedanken sind frei ... Schon gesehen? Jetzt Spot online ansehen: http://www.gmx.net/de/go/tv-spot __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Error in load(dataFile, myEnv)
Looks like you have your own version of a load() function around. Try ?conflicts to see what you may have masked. On Tue, 1 Feb 2005, Zhesi He wrote: Dear all, I just found that some of the packages are not able to load any more, after I installed R2.0.1 in my Mac, it even affects my old R1.8 installs. It gives me errors when I load packages that contains myEnv settings. such as: RMySQL, DBI, Rggobi, etc. But others that does not require myENV is all right, like tcltk that only calls the c functions. The errors are like: Error in load(dataFile, myEnv) : unused argument(s) ( ...) Error in library(DBI) : .First.lib failed for 'DBI' I had a look at the package file that contains .First.lib, fullName - paste(package, pkgname, sep=:) myEnv - as.environment(match(fullName, search())) dataFile - file.path(libname, pkgname, R, all.rda) rm(.First.lib, envir = myEnv) load(dataFile, myEnv) I found that myEnv is not set. as the package can not be matched in search(). If I comment the line load(dataFile, myEnv), then the package is loaded without errors but there no functions is loaded at all. It probably is something trivial. Can some one help, please? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Split-split plot ANOVA
Hi Mike, *An example of the use of aov() for a split-plot is in MASS library(MASS) example(Oats) The book also gives a detailed explanation *pp 45-52 of the Pinheiro and Bates book gives you an example of the use of lme() on a split-plot. If you have a non balanced design, lme() from the nlme library might be a better tool than aov(). Also, if you have the lme4 library installed you'll have a lot more flexibility on the formulation of your random effects. regards, Jesus -- Jesús María Frías Celayeta School of Food Sci. and Env. Health. Faculty of Tourism and Food Dublin Institute of Technology Cathal Brugha St., Dublin 1. Ireland t +353 1 4024459 f +353 1 4024495 w www.dit.ie/DIT/tourismfood/science/staff/frias.html -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mike Saunders Sent: 01 February 2005 14:36 To: R Help Subject: [R] Split-split plot ANOVA Does someone out there have an example of R-code for a split-split plot ANOVA using aov or another function? The design is not balanced. I never set up one in R before and it would be nice to see an example before I tackle a very complex design I have to model. Thanks, Mike Mike Saunders Research Assistant Forest Ecosystem Research Program Department of Forest Ecosystem Sciences University of Maine Orono, ME 04469 207-581-2763 (O) 207-581-4257 (F) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- This message has been scanned for content and viruses by the DIT Information Services MailScanner Service, and is believed to be clean. http://www.dit.ie -- This message has been scanned for content and viruses by the DIT Information Services MailScanner Service, and is believed to be clean. http://www.dit.ie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RE: aggregating dates
Gabor Grothendieck ggrothendieck at myway.com writes: : : The issue is just that you need to add POSIXt to the class vector to : be absolutely correct. : :class(x) - c(POSIXt, POSIXct) : : is the same as : :structure(x, class = c(POSIXt, POSIXct)) : : The only reason the table used the latter was to put it in functional : form rather than lvalue form. The class form that you are using does : have the advantage of not manipulating the underlying representation : directly. The way that class(x) - POSIXct might ail would be if there : were a POSIXt method that should be applied since it would then never : find it. Just a follow up. Here is a simple example of class(y) - POSIXct failing while class(x) - c(POSIXt, POSIXct) works. In the first example below (x) the class is correct and converting the POSIXct date to character gives the expected date representation but in the second example (y) the class is incomplete and converting it to character gives an unexpected result: R x - structure(0, class = c(POSIXt, POSIXct)) R as.character(x) [1] 1969-12-31 19:00:00 R y - structure(0, class = POSIXct) R as.character(y) [1] 0 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] glmmPQL
Does someone know what is the integration method of the random effect in glmmPQL function?? Please advise. Tnks, Mariana. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Matrix langage
Hello, I would like to use R in a laboratory. They use actually IML of the SAS-Society. With this IMLangage, you can enter a mathematical formula with sum from i to n, transpose matrix, sum of a colonne and all this stuff. After that, the software can translate it in a program. I am not currently use R in Matrix langage. But I manipulate data frame. I have the feeling that R can do like SAS do. What do you think about it? Thanks in advance, Pierre-Olivier Chasset __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Convergence problems with survreg()
Dear R mailing list, I'm trying to fit a censored regression model to a large (dimension of the design matrix is 2e5 by 7) right truncated data by means of the survreg(Surv()) function, as suggested by Paul Johnson on his R Tips web page. Possibly due to the sensitivity to the initial values of the Newton-Raphson routine in use by survreg(), resulting regression outputs turn out to be unreliable. Should the init field be left blank, the maximisation barely starts (2 iterations), and ends up yielding estimates close to 0 or +/- infinity. I guess the problem mainly lies in reasonably specifying starting values for the optimisation embedded in survreg(). Even by inputing OLS estimates (the default in the SAS lifereg method) ensuing inferences are remarkably different, and with significantly lower log-likelihood, than the ones returned by the SAS proc lifereg. Has anybody encountered a similar problem? If so, any suggestion/advise would be grately appreciated. Many thanks in advance, all best, -- Dr. Stefano Conti Department of Probability and Statistics The Hicks Building University of Sheffield Sheffield S3 7RH UK Phone # +44 (0)114 2223854 Fax # +44 (0)114 2223759 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Matrix langage
All of this is possible, and very easy, in R. See the Intro to R book. Doug Bates also has an article in the recent edition of R News showing how to perform matrix operations for least squares. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pierre-Olivier Chasset Sent: Tuesday, February 01, 2005 1:22 PM To: r-help@stat.math.ethz.ch Subject: [R] Matrix langage Hello, I would like to use R in a laboratory. They use actually IML of the SAS-Society. With this IMLangage, you can enter a mathematical formula with sum from i to n, transpose matrix, sum of a colonne and all this stuff. After that, the software can translate it in a program. I am not currently use R in Matrix langage. But I manipulate data frame. I have the feeling that R can do like SAS do. What do you think about it? Thanks in advance, Pierre-Olivier Chasset __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] GRASS - R
Hello, I would like to know if someone uses R with GRASS ( SIG software) . Alexandre DEPIRE INRETS / GARIG __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Matrix langage
Matrix manipulations are a strength of R. If A and B are matrices, (A+B) adds them and (A %*% B) is the usual matrix multiplication; A*B is elementwise multiplication. qr(A) = the Q-R decomposition; svd(A) = singular value decomposition. eigen(A) = eigenvalue-eigenvector decomposition (except if you need some special Jordon form with repeated roots). Have you looked at ch. 5 in An Introduction to R under www.r-project.org - Documentation: Manuals. hope this helps. spencer graves Pierre-Olivier Chasset wrote: Hello, I would like to use R in a laboratory. They use actually IML of the SAS-Society. With this IMLangage, you can enter a mathematical formula with sum from i to n, transpose matrix, sum of a colonne and all this stuff. After that, the software can translate it in a program. I am not currently use R in Matrix langage. But I manipulate data frame. I have the feeling that R can do like SAS do. What do you think about it? Thanks in advance, Pierre-Olivier Chasset __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rcmdr doesn't seem to work
Alle 15:33, martedì 1 febbraio 2005, Prof Brian Ripley ha scritto: On Tue, 1 Feb 2005 [EMAIL PROTECTED] wrote: Got it and now it all worksBUT I'm puzzled by the fact that I systematically update all the packages in R 2.0.1 using 'update.packages()'. Why in this case R was unable to find the obsolete versions of Rcmdr and rgl and substitued the with new ones? Were they `obselete versions'? Almost surely not, just built against the wrong version of R. As from R 2.1.0 there is update.packages(checkBuilt=TRUE) for precisely this job. Update.packages() updates the versions of the packages, not of R: why did you think otherwise? I understand now that my mistake was to force the installer of the binaries under win xp to use always the same directory to install the different versions of the programme, that is d:\programmi\R, without any reference to the version itself. This causes kind of of a sedimentation of obsolete stuff. Thanks for the answer. Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] polynomials REML and ML in nlme
Hello everyone, I hope this is a fair enough question, but I dont have access to a copy of Bates and Pinheiro. It is probably quite obvious but the answer might be of general interest. If I fit a fixed effect with an added quadratic term and then do it as an orthogonal polynomial using maximum likelihood I get the expected result- they have the same logLik. mod2a-lme(wthole~nplants+I(nplants^2),data=d3,random=~1|field/subplot,m ethod=ML) mod2b-lme(wthole~poly(nplants,2),data=d3,random=~1|field/subplot,method =ML) anova(mod2a,mod2b) Model df AIC BIClogLik mod2a 1 6 6698.231 6723.869 -3343.116 mod2b 2 6 6698.231 6723.869 -3343.116 However if I fit the two models by REML they are not considered to be the same and I get warned. anova(mod2a.REML,mod2b.REML) Model df AIC BIClogLik mod2a.REML 1 6 6680.616 6706.219 -3334.308 mod2b.REML 2 6 .915 6692.518 -3327.457 Warning message: Fitted objects with different fixed effects. REML comparisons are not meaningful. in: anova.lme(mod2a.REML, mod2b.REML) Well yes, I suppose thats right, they are not the same fixed effects. But why does REML give them such different Log likelihoods? And what should I do if I want to compare a larger set of models. For example the following, admittedly overparameterised model, can be fitted (slowly) by either method mod4-lme(wthole~poly(nplants,2),data=d3,random=~poly(nplants,2)|field/ subplot,method=ML) But this doesnt work by either method mod4-lme(wthole~nplants+I(nplants^2),data=d3,random=~nplants+I(nplants^ 2)|field/subplot,method=ML) Error in solve.default(pdMatrix(a, fact = TRUE)) : system is computationally singular: reciprocal condition number = 2.58558e-045 Thanks in advance for clearing up my confusion. The gentler the explanation, the more useful it would be as far as I am concerned as I am not a statistician and have to admit I am not at all clear how REML actually works. Duncan Dr Duncan Golicher Ecologia y Sistematica Terrestre Conservación de la Biodiversidad El Colegio de la Frontera Sur San Cristobal de Las Casas, Chiapas, Mexico Tel. 967 1883 ext 9814 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] taking data out of a dataframe
hello, I have a problem with using the results of a certain function. This function is the tree function. If I use it to produce a tree say with the data iris from the help page, I can see the attributes of my result. Now I need to use a column of the attributes of my tree ir.tr, is there any way or function that permits me to take this column out? THanks in advance Nicolas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] GRASS - R
On Tue, 1 Feb 2005, Depire Alexandre wrote: Hello, I would like to know if someone uses R with GRASS ( SIG software) . Yes, please see http://grass.itc.it/statsgrass/index.html, and consider asking again on the mailing list referenced there, perhaps with more details of what you want to use R with GRASS for. Alexandre DEPIRE INRETS / GARIG __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] RODBC - connect is failing
I get the following errors when attempting an ODBC connection to a MySQL db. 1: [RODBC] ERROR: state HY000, Code 0, message [MySQL] [ODBC 3.51 Driver] Could not determine the driver name so could not lookup setup library. 2: ODBCConnection failed in: odbcDriverConnect(st, case=case, believeNRows=believeNRows). Win XP sp2 MySQL 4.1.8 My SQLODBC 3.51.10 Package RODBC (latest) is installed. LibMySQL.dll is in about a 1/2 dozen directories including Winnt\System32, my PHP directory, and several MySQL directories. I note that there are apparently different versions of this file (different file sizes and dates) so I'm not sure if there is a problem here. I've searched the archives and found nothing other than a suggestion to put the dll in the \system32 directory which didn't help. If I missed the key posting, just point me in the right direction and I'll go get the info. Not sure where to go from here so any pointers are appreciated. Doug ps - the ODBC driver is working - I can test if from the Windows Control Panel and get a successful connect. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] New R/Splus Course***Interactive and Dynamic Graphics for Data Analysis Using XGobi/GGobi in San Francisco
XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce our new 2-day course: R/Splus Course***Interactive and Dynamic Graphics for Data Analysis Using XGobi/GGobi in San Francisco: www.xlsolutions-corp.com/training.htm San Francisco, CA February 21st-22nd, 2005 Reserve your seat now at the early bird rates! Payment due AFTER the class. Course Description: This course is designed as a hands-on introduction to direct manipulation and dynamic graphics for exploring multi-dimensional data. The course will focus on the data visualization tools available in GGobi, which can be accessed from the data analysis package, S/R. Course Outline: - Introduction and overview of graphics for multidimensional data with GGobi - Exploring the distribution of missing values with GGobi - Graphics for classification, both supervised and unsupervised with GGobi - Exploratory spatio-temporal data analysis with GGobi - Analysis of microarray Data with GGobi - Exploring multivariate longitudinal data with GGobi - Proximity analysis and multidimensional scaling with GGobi - Categorical data and ANOVA with GGobi - Inference for data visualization with GGobi - Strategies for handling large data with GGobi Email us for group discounts. Email Sue Turner: [EMAIL PROTECTED] Phone: 206-686-1578 Visit us: www.xlsolutions-corp.com/training.htm Please let us know if you and your colleagues are interested in this classto take advantage of group discount. Register now to secure your seat! Interested in R/Splus Advanced course? email us. Cheers, Elvis Miller, PhD Manager Training. XLSolutions Corporation 206 686 1578 www.xlsolutions-corp.com [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A rude question
One point that did not get mentioned in this discussion, and I believe deserves much more publicity, is the impact of packages tests. The design of the package system allows package developers to put tests in packages, and these are checked regularly (see http://cran.at.r-project.org/contrib/checkSummary.html). These are intended to test the package functionality, but also give R what is perhaps the largest test suite of any statistical software (certainly the most quickly growing). While any single package's test will never guarantee that the package works perfectly, the ensemble goes a long way toward ensuring that core R functionality behaves as intended. It seems unlikely to me that any commercial effort will ever be able to catch up. There are several ways that tests can add to our confidence that calculations can be trusted. They can - check against theoretical results - check against published results - check against results from other software - check that calculations done in different ways give the same result - check that monte carlo experiments give distributions that are consistent with expected results Some of these are relatively time consuming to set up and check the first time, but after that they can be automatic. If you have particular calculations with specific packages that you are especially concerned about, I encourage you to participate by devising good tests and sending them to the package developers. (But first check the tests they are already doing in the package tests directory.) Paul Gilbert [EMAIL PROTECTED] wrote: Dear all, I am beginner using R. I have a question about it. When you use it, since it is written by so many authors, how do you know that the results are trustable?(I don't want to affend anyone, also I trust people). But I think this should be a question. Thanks, Ming __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] GRASS - R
Hello, I never used it but there is a package on CRAN that interfaces R with GRASS, see : http://finzi.psych.upenn.edu/R/library/GRASS/html/00Index.html I had 152 hits on searching GRASS on http://www-r.project.org -- Search -- RsiteSearch. Maybe you'll find answers there. Romain. Le 01.02.2005 19:27, Depire Alexandre a écrit : Hello, I would like to know if someone uses R with GRASS ( SIG software) . Alexandre DEPIRE INRETS / GARIG __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Romain FRANCOIS : [EMAIL PROTECTED] page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 ___ Etudiant en 3eme année Institut de Statistique de l'Université de Paris (ISUP) Filière Industrie et Services http://www.isup.cicrp.jussieu.fr/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] vectorization of a data-aggregation loop
Hi I have a simple question: the following data.frame id iwv type 1 1 1a 2 1 2b 3 1 11b 4 1 5a 5 1 6c 6 2 4c 7 2 3c 8 2 10a 9 3 6b 10 3 9a 11 3 8b 12 3 7c shall be aggregated into the form: id t.a t.b t.c 1 1 6 13 6 6 2 10 0 7 9 3 9 14 7 means for each 'type' (a, b, c) a new column is introduced which gets the sum of iwv for the respective observations 'id' of course I can do this transformation/aggregation in a loop (see below), but is there a way to do this more efficiently, eg. in using tapply (or something similar)- since I have lot many rows? thanks for a hint christoph #-- # the loop-way t - data.frame(cbind(c(1,1,1,1,1,2,2,2,3,3,3,3), c(10,12,8,33,34,3,27,77,34,45,4,39), c('a', 'b', 'b', 'a', 'c', 'c', 'c', 'a', 'b', 'a', 'b', 'c'))) names(t) - c(id, iwv, type) t$iwv - as.numeric(t$iwv) t # define the additional columns (type.a, type.b, type.c) tt - rep(0, nrow(t) * length(levels(t$type))) dim(tt) - c(nrow(t), length(levels(t$type))) tt - data.frame(tt) dimnames(tt)[[2]] - paste(t., levels(t$type), sep = ) t - cbind(t, tt) t obs - 0 obs.previous - 0 row.elim - rep(FALSE, nrow(t)) ta - which((names(t) == t.a)) #number of column which codes the first type r.ctr - 0 for (i in 1:nrow(t)){ obs - t[i,]$id if (obs == obs.previous) { row.elim[i] - TRUE r.ctr - r.ctr + 1 #increment type.col - as.numeric(t[i,]$type) t[i - r.ctr, ta - 1 + type.col] - t[i - r.ctr, ta - 1 + type.col] + t[i,]$iwv } else { r.ctr - 0 #record counter type.col - as.numeric(t[i,]$type) t[i, ta - 1 + type.col] - t[i,]$iwv } obs.previous - obs } t - t[!row.elim,] t - subset(t, select = -c(iwv, type)) t #-- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A rude question
Paul Gilbert wrote: The design of the package system allows package developers to put tests in packages, and these are checked regularly (see ... This link should have been http://cran.at.r-project.org/src/contrib/checkSummary.html. Paul Gilbert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Hugh image created from modest data
Simon: ls(all=TRUE) will show you all objects in your workspace. If you have plot history recording turned on,for example,.SavedPlots can get quite large and will be part of your saved image. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Gatehouse Sent: Tuesday, February 01, 2005 2:10 PM To: r-help@stat.math.ethz.ch Subject: [R] Hugh image created from modest data Dear R users, I am running R2.1 on windows XP SP2. I have a problem that I fear I am providing insufficient information to resolve. But if anyone can suggest directions to understand the problem I would be most grateful. I import modest datasets which create a list of data frames (primary data object) amounting to 15.9Mb when measured internally by object.size() . The sizes of the list components in the primary data object are consistent with the total, again when measured by object.size() All other objects in my work area contribute less than 2Kb After doing some analysis the primary data object would on occasions expand to 800Mb but is (usually) cut back prior to saving the image of the work area on exiting, or at sparse intervals during processing. The situation now is that internally, as measured by object.size(), my working directory is less than 16Megs but image.save is creating an .Rdata image in excess of 800Meg. Could this be consistent in some way? If it is not, or is unusual, how would I go about finding the extra, unwanted information and removing it. Any comment or suggestions would be appreciated Simon Gatehouse [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] New problem printing °C in plots
version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor0.1 year 2004 month11 day 15 language R paste(25, °C, sep = ) [1] 25\302\260C In ESS, I get 25\201\260C The °C does end up in the plot alright, but it has an accented A as well which is not useful. (The '°C' I get from within Emacs using C - x 8 - o) GNU Emacs 21.3.1 In earlier versions, I used to get this: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor8.1 year 2003 month11 day 21 language R paste(25, °C, sep = ) [1] 25°C That plotted fine. I can't remember if the problem existed with R-2.0.0 and I didn't notice a mention the NEWS file/s -- but that could be because I didn't know what to look for. Could this be purely an Emacs problem, or does it have to do with changes in R-2.x.x? TIA -- Patrick Connolly HortResearch Mt Albert Auckland New Zealand Ph: +64-9 815 4200 x 7188 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ I have the world`s largest collection of seashells. I keep it on all the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] vectorization of a data-aggregation loop
On Tue, 2005-02-01 at 23:28 +0100, Christoph Lehmann wrote: Hi I have a simple question: the following data.frame id iwv type 1 1 1a 2 1 2b 3 1 11b 4 1 5a 5 1 6c 6 2 4c 7 2 3c 8 2 10a 9 3 6b 10 3 9a 11 3 8b 12 3 7c shall be aggregated into the form: id t.a t.b t.c 1 1 6 13 6 6 2 10 0 7 9 3 9 14 7 means for each 'type' (a, b, c) a new column is introduced which gets the sum of iwv for the respective observations 'id' of course I can do this transformation/aggregation in a loop (see below), but is there a way to do this more efficiently, eg. in using tapply (or something similar)- since I have lot many rows? thanks for a hint Well, I'll get you started using the sample data you have above. Presuming that your data is in a data frame called 'df': # Use aggregate to get the summations data by id and type df.a - aggregate(df$iwv, by = list(df$id, df$type), sum) # Show the results df.a Group.1 Group.2 x 1 1 a 6 2 2 a 10 3 3 a 9 4 1 b 13 5 3 b 14 6 1 c 6 7 2 c 7 8 3 c 7 # Now use xtabs() to create a contingency table from df.a xtabs(x ~ Group.1 + Group.2, data = df.a) Group.2 Group.1 a b c 1 6 13 6 2 10 0 7 3 9 14 7 You can now modify the colnames in the result of the xtabs step as you desire. It's a little easier in two steps. See ?aggregate and ?xtabs for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] New problem printing °C in plots
That this prints as an octal escape was always the intention: it is your OS that is telling R that it is not a printable character. What locale are you in? For me 1) In en_GB this works (correct, as that is charset ISO-8859-1) 2) In C, I get 25\260C (correct, as that is not an ASCII char) My guess is that you have R running in a C locale and emacs in a UTF-8 locale, since the UTF-8 representation of that symbol is c2b0, in octal \302\260. If that is what is going on, 1.8.1 would have been equally confused (it might have printed UTF-8, but it would not plot it), so I suspect the important change is not the one you think it is. Note that at least one set of RPMs now runs R in the C locale (but that's not part of R per se). If you run in en_NZ I think you will find R works to your taste. The good news is that R-devel already supports en_NZ.utf8, and so 2.1.0 will in a couple of months. On Wed, 2 Feb 2005, Patrick Connolly wrote: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor0.1 year 2004 month11 day 15 language R paste(25, °C, sep = ) [1] 25\302\260C In ESS, I get 25\201\260C The °C does end up in the plot alright, but it has an accented A as well which is not useful. (The '°C' I get from within Emacs using C - x 8 - o) GNU Emacs 21.3.1 BTW, the plot device matters too. In earlier versions, I used to get this: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor8.1 year 2003 month11 day 21 language R paste(25, °C, sep = ) [1] 25°C That plotted fine. I can't remember if the problem existed with R-2.0.0 and I didn't notice a mention the NEWS file/s -- but that could be because I didn't know what to look for. Could this be purely an Emacs problem, or does it have to do with changes in R-2.x.x? Neither of those, is my guess. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Error in load(dataFile, myEnv)
Dear Prof Ripley, Thanks for your reply. I couldn't find anything wrong with Load() function. It seems that myEnv is not set, as myEnv - as.environment(match(fullName, search())) does not return a valid value. Also, when I commented the load(dataFile, myEnv) line, the rest of .First.lib code does not work (no function is loaded, e.g. when I input the function in the package, it doesn't recognise it) Any suggestions? Zhesi. - Original Message - From: Prof Brian Ripley [EMAIL PROTECTED] To: Zhesi He [EMAIL PROTECTED] Cc: R-help@stat.math.ethz.ch Sent: Tuesday, February 01, 2005 3:39 PM Subject: Re: [R] Error in load(dataFile, myEnv) Looks like you have your own version of a load() function around. Try ?conflicts to see what you may have masked. On Tue, 1 Feb 2005, Zhesi He wrote: Dear all, I just found that some of the packages are not able to load any more, after I installed R2.0.1 in my Mac, it even affects my old R1.8 installs. It gives me errors when I load packages that contains myEnv settings. such as: RMySQL, DBI, Rggobi, etc. But others that does not require myENV is all right, like tcltk that only calls the c functions. The errors are like: Error in load(dataFile, myEnv) : unused argument(s) ( ...) Error in library(DBI) : .First.lib failed for 'DBI' I had a look at the package file that contains .First.lib, fullName - paste(package, pkgname, sep=:) myEnv - as.environment(match(fullName, search())) dataFile - file.path(libname, pkgname, R, all.rda) rm(.First.lib, envir = myEnv) load(dataFile, myEnv) I found that myEnv is not set. as the package can not be matched in search(). If I comment the line load(dataFile, myEnv), then the package is loaded without errors but there no functions is loaded at all. It probably is something trivial. Can some one help, please? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R-Project Plot: Creating browser map tags
Hi, I have started looking into using R for generating graphs displayed in a web browser and it produces really nice graphics. One of the requirements I have is to construct HTML map tags over the graphs so that users can click on elements of the graph (e.g. bars of a histogram) and either see interesting information or navigate to another page. I see how to produce JPEG images with R that can be readily embedded in an HTML page but did not see how to output information to produce maps. Could anyone tell if this is possible and if so how? Many thanks -- Jon Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] polynomials REML and ML in nlme
Duncan, I think that the problem in your comparison is locatted in the method of estimation of fixed-effects: in REML they are not estimated maximizing a joint likelihood function including fixed-effects and variance- covariance components as ML does. So when it comes down to different fixed-effects specifications, they can't be compared directly by means of the log-likelihoods. Best Regards, Alex. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dgoliche Sent: Tuesday, February 01, 2005 10:54 AM To: r-help@stat.math.ethz.ch Subject: [R] polynomials REML and ML in nlme Hello everyone, I hope this is a fair enough question, but I dont have access to a copy of Bates and Pinheiro. It is probably quite obvious but the answer might be of general interest. If I fit a fixed effect with an added quadratic term and then do it as an orthogonal polynomial using maximum likelihood I get the expected result- they have the same logLik. mod2a-lme(wthole~nplants+I(nplants^2),data=d3,random=~1|field /subplot,m ethod=ML) mod2b-lme(wthole~poly(nplants,2),data=d3,random=~1|field/subp lot,method =ML) anova(mod2a,mod2b) Model df AIC BIC logLik mod2a 1 6 6698.231 6723.869 -3343.116 mod2b 2 6 6698.231 6723.869 -3343.116 However if I fit the two models by REML they are not considered to be the same and I get warned. anova(mod2a.REML,mod2b.REML) Model df AIC BIC logLik mod2a.REML 1 6 6680.616 6706.219 -3334.308 mod2b.REML 2 6 .915 6692.518 -3327.457 Warning message: Fitted objects with different fixed effects. REML comparisons are not meaningful. in: anova.lme(mod2a.REML, mod2b.REML) Well yes, I suppose thats right, they are not the same fixed effects. But why does REML give them such different Log likelihoods? And what should I do if I want to compare a larger set of models. For example the following, admittedly overparameterised model, can be fitted (slowly) by either method mod4-lme(wthole~poly(nplants,2),data=d3,random=~poly(nplants ,2)|field/ subplot,method=ML) But this doesnt work by either method mod4-lme(wthole~nplants+I(nplants^2),data=d3,random=~nplants+ I(nplants^ 2)|field/subplot,method=ML) Error in solve.default(pdMatrix(a, fact = TRUE)) : system is computationally singular: reciprocal condition number = 2.58558e-045 Thanks in advance for clearing up my confusion. The gentler the explanation, the more useful it would be as far as I am concerned as I am not a statistician and have to admit I am not at all clear how REML actually works. Duncan Dr Duncan Golicher Ecologia y Sistematica Terrestre Conservación de la Biodiversidad El Colegio de la Frontera Sur San Cristobal de Las Casas, Chiapas, Mexico Tel. 967 1883 ext 9814 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ AntiPop-up UOL - É grátis! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] selecting subsets of data for analysis
can you tell me how to ask R to analyse a subset of data eg. supposing the data set consists of 9 columns and I only want R to analyse columns 1, 3 and 5 how would I command R to conduct eg. boxplots of those variables only? thanks brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] taking data out of a dataframe
In general if you are using a package, it helps to identify the package. I assume it is the tree package. Is this what you are after (from the example on the ?tree page) attr(ir.tr,ylevels) [1] setosa versicolor virginica Tom -Original Message- From: NICOLAS DEIG [mailto:[EMAIL PROTECTED] Sent: Wednesday, 2 February 2005 3:10 AM To: r-help@stat.math.ethz.ch Subject: [R] taking data out of a dataframe hello, I have a problem with using the results of a certain function. This function is the tree function. If I use it to produce a tree say with the data iris from the help page, I can see the attributes of my result. Now I need to use a column of the attributes of my tree ir.tr, is there any way or function that permits me to take this column out? THanks in advance Nicolas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] aggregation with extra columns
R People, Thanks for your help on my recent questions, Excel is never going to disappear from my office but with graphics from lattice package and some other stuff in R I have been able to add some value. I have a problem I haven't been able to figure out with aggregation, I mentioned it earlier but didn't state it very clearly. Basically I have many defect events and I want to grab the most recent event for each defect number: eg: date defectnum state 2004-12-1 10 create 2004-12-2 11 create 2004-12-4 10 close 2004-12-7 11 fix to: date defectnum state 2004-12-4 10 close 2004-12-7 11 fix Now with aggregate I can get the rows I want but not with the state attached: aggregate(list(date=ev$date), by=list(defectnum=ev$defectnum), max) Gives me the rows I want but I have lost the state. I have tried doing a merge afterwards but now I realise why they warned me avoid using dates as database keys. What would be handy is somehow getting back the index vector from the aggregate function. I realize in the general case this wouldn't work for aggregate but in the case of min/max the result is a specific record. Someone earlier mentioned some tricks with sort but I haven't been able to make that get to where I want. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] New problem printing °C in plots
On Tue, 01-Feb-2005 at 11:33PM +, Prof Brian Ripley wrote: | That this prints as an octal escape was always the intention: it is your | OS that is telling R that it is not a printable character. What locale | are you in? For me | | 1) In en_GB this works (correct, as that is charset ISO-8859-1) | 2) In C, I get 25\260C (correct, as that is not an ASCII char) | | My guess is that you have R running in a C locale and emacs in a UTF-8 | locale, since the UTF-8 representation of that symbol is c2b0, in octal | \302\260. If that is what is going on, 1.8.1 would have been equally | confused (it might have printed UTF-8, but it would not plot it), so I 1.8.1 was not confused. Maybe confused to a similar degree, but confused in a different way. It prints to screen and it used to plot to a postscript device fine. I seem to remember that it didn't plot to an X11 device correctly. Now, X11 and postscript both have the extra character. [...] | | Note that at least one set of RPMs now runs R in the C locale (but that's | not part of R per se). If you run in en_NZ I think you will find R works | to your taste. The good news is that R-devel already supports en_NZ.utf8, | and so 2.1.0 will in a couple of months. I've found that simply using the string \260C instead of Emacs's trick works both in X11 and postscript, so I'll survive until then -- though I kind of miss that bit of WYSIWYG. Thanks -- Patrick Connolly HortResearch Mt Albert Auckland New Zealand Ph: +64-9 815 4200 x 7188 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ I have the world`s largest collection of seashells. I keep it on all the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] GUI under linux for R
Hi, I'm wondering whether there is GUI under linux. I checked the website, it has Emacs(ESS), IDE/Scrip Editors etc. I am looking for one which is similar to the GUI under windows. Thanks, Ming __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R CMD BATCH character limit?
Is there a limit on the number of characters in an invocation like R CMD BATCH --opt1=val1 --opt2=val2 ... --save-to=C:\very\long\string ..\R\script.R ? I am running R 2.0.1 on Windows XP, and when running a long BATCH command (about 400--500 characters) the last option gets mangled, as can be seen from a warning in script.Rout that looks like this: WARNING: unknown option +--save-to=C:\very\long\str..\R\script.Rout Note that string is truncated to str _and_ concatenated with the implicit batch output file ..\R\script.Rout. (The unknown option warning is expected; I am just using commandArgs() within the script to pick out the arguments.) I have tried specifying --args before the options, with the same result, except that the truncation appears earlier. Thanks in advance for any help! Best Regards, Hsiu-Khuern Tang. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] aggregation with extra columns
I think Gabor gave you the answer, even if you didn't see it x - rep(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92),each = 5) z - data.frame(Date = strptime(x, %m/%d/%y)) z$Value - trunc(runif(25) * 5) + 1 z$State - c(A,B,C,D,E)[z$Value] z - z[order(z$Date),] z z[aggregate(1:nrow(z), list(z$State), max)$x,] Tom Even if it's not quite right, the technique is there. -Original Message- From: Paul Sorenson [mailto:[EMAIL PROTECTED] Sent: Wednesday, 2 February 2005 9:18 AM To: r-help@stat.math.ethz.ch Subject: [R] aggregation with extra columns R People, Thanks for your help on my recent questions, Excel is never going to disappear from my office but with graphics from lattice package and some other stuff in R I have been able to add some value. I have a problem I haven't been able to figure out with aggregation, I mentioned it earlier but didn't state it very clearly. Basically I have many defect events and I want to grab the most recent event for each defect number: eg: datedefectnum state 2004-12-1 10 create 2004-12-2 11 create 2004-12-4 10 close 2004-12-7 11 fix to: datedefectnum state 2004-12-4 10 close 2004-12-7 11 fix Now with aggregate I can get the rows I want but not with the state attached: aggregate(list(date=ev$date), by=list(defectnum=ev$defectnum), max) Gives me the rows I want but I have lost the state. I have tried doing a merge afterwards but now I realise why they warned me avoid using dates as database keys. What would be handy is somehow getting back the index vector from the aggregate function. I realize in the general case this wouldn't work for aggregate but in the case of min/max the result is a specific record. Someone earlier mentioned some tricks with sort but I haven't been able to make that get to where I want. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] postscript symbols?
dear R wizards: is it possible to use a postscript font symbol as a plot symbol?in particular, I want to use the four postscript symbols for playing cards (club, heart, spade, diamond) as points. In LaTeX, these four are \Pisymbol{psy}{A7} \Pisymbol{psy}{A8} \Pisymbol{psy}{A9} \Pisymbol{psy}{A10} and what I would love to do is place them, at say, (x=1,y=1), (x=2,y=2), (x=3,y=3) and (x=4,y=4). Help appreciated---or merely a note that this is impossible. regards, /iaw --- ivo welch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] FW: Document1
-Original Message- From: Brett Stansfield Sent: Wednesday, 19 January 2005 4:25 p.m. To: '[EMAIL PROTECTED]' Subject: Document1 Doc1.doc I was trying to get R to analyse one variable of the file Chicken Weight. when I ask hist(data$weight) R says x must be numeric yet when I check the data using Editor, it says quite clearly that variable name weight is numeric. what am I doing wrong here? I have attached a view from the console Brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] FW: Document1
-Original Message- From: Brett Stansfield Sent: Wednesday, 19 January 2005 4:25 p.m. To: '[EMAIL PROTECTED]' Subject: Document1 Doc1.doc I was trying to get R to analyse one variable of the file Chicken Weight. when I ask hist(data$weight) R says x must be numeric yet when I check the data using Editor, it says quite clearly that variable name weight is numeric. what am I doing wrong here? I have attached a view from the console Brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] (no subject)
can you recommend a good manual for R that starts with a data set and gives demonstrations on what can be done using R? I downloadedR Langauage definition and An introduction to R but haven't found them overly useful. I'd really like to be able to follow some tutorials using a dataset or many datasets. The datasets I have available on R are Data sets in package 'datasets': AirPassengers Monthly Airline Passenger Numbers 1949-1960 BJsales Sales Data with Leading Indicator BJsales.lead (BJsales) Sales Data with Leading Indicator BOD Biochemical Oxygen Demand CO2 Carbon Dioxide uptake in grass plants ChickWeight Weight versus age of chicks on different diets DNase Elisa assay of DNase EuStockMarkets Daily Closing Prices of Major European Stock Indices, 1991-1998 FormaldehydeDetermination of Formaldehyde HairEyeColorHair and Eye Color of Statistics Students Harman23.corHarman Example 2.3 Harman74.corHarman Example 7.4 IndomethPharmacokinetics of Indomethicin InsectSpraysEffectiveness of Insect Sprays JohnsonJohnson Quarterly Earnings per Johnson Johnson Share LakeHuron Level of Lake Huron 1875-1972 LifeCycleSavingsIntercountry Life-Cycle Savings Data LoblollyGrowth of Loblolly pine trees NileFlow of the River Nile Orange Growth of orange trees OrchardSprays Potency of Orchard Sprays PlantGrowth Results from an Experiment on Plant Growth Puromycin Reaction velocity of an enzymatic reaction Seatbelts Road Casualties in Great Britain 1969-84 Theoph Pharmacokinetics of theophylline Titanic Survival of passengers on the Titanic ToothGrowth The Effect of Vitamin C on Tooth Growth in Guinea Pigs UCBAdmissions Student Admissions at UC Berkeley UKDriverDeaths Road Casualties in Great Britain 1969-84 UKgas UK Quarterly Gas Consumption USAccDeaths Accidental Deaths in the US 1973-1978 USArrests Violent Crime Rates by US State USJudgeRatings Lawyers' Ratings of State Judges in the US Superior Court USPersonalExpenditure Personal Expenditure Data VADeathsDeath Rates in Virginia (1940) WWWusageInternet Usage per Minute WorldPhones The World's Telephones ability.cov Ability and Intelligence Tests airmilesPassenger Miles on Commercial US Airlines, 1937-1960 airquality New York Air Quality Measurements anscombeAnscombe's Quartet of Identical Simple Linear Regressions attenu The Joyner-Boore Attenuation Data attitudeThe Chatterjee-Price Attitude Data austres Quarterly Time Series of the Number of Australian Residents beaver1 (beavers) Body Temperature Series of Two Beavers beaver2 (beavers) Body Temperature Series of Two Beavers carsSpeed and Stopping Distances of Cars chickwtsChicken Weights by Feed Type co2 Mauna Loa Atmospheric CO2 Concentration discoveries Yearly Numbers of Important Discoveries esoph Smoking, Alcohol and (O)esophageal Cancer euroConversion Rates of Euro Currencies euro.cross (euro) Conversion Rates of Euro Currencies eurodistDistances Between European Cities faithfulOld Faithful Geyser Data fdeaths (UKLungDeaths) Monthly Deaths from Lung Diseases in the UK freeny Freeny's Revenue Data freeny.x (freeny) Freeny's Revenue Data freeny.y (freeny) Freeny's Revenue Data infert Infertility after Spontaneous and Induced Abortion irisEdgar Anderson's Iris Data iris3 Edgar Anderson's Iris Data islands Areas of the World's Major Landmasses ldeaths (UKLungDeaths) Monthly Deaths from Lung Diseases in the UK lh Luteinizing Hormone in Blood Samples longley Longley's Economic Regression Data lynxAnnual Canadian Lynx trappings 1821-1934 mdeaths (UKLungDeaths) Monthly Deaths from Lung Diseases in the UK morley Michaelson-Morley Speed of Light Data mtcars Motor Trend Car Road Tests nhtemp Average Yearly Temperatures in New Haven nottem Average Monthly Temperatures at Nottingham, 1920-1939
Re: [R] selecting subsets of data for analysis
On Wed, 2005-02-02 at 13:54 +1300, Brett Stansfield wrote: can you tell me how to ask R to analyse a subset of data eg. supposing the data set consists of 9 columns and I only want R to analyse columns 1, 3 and 5 how would I command R to conduct eg. boxplots of those variables only? #Create a matrix with 9 columns mat - matrix(rnorm(90), ncol = 9) # create a boxplot from cols 1,3 and 5 boxplot(data.frame(mat[, c(1, 3, 5)])) In this case, passing the 3 columns of the matrix as a data frame enables boxplot() to plot the 3 columns in a single call. There is an example of this in ?boxplot. You might also want to review the help for extracting sections of multi- dimensional objects: ?Extract or ?[ and the examples therein. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] GUI under linux for R
On Tue, 2005-02-01 at 19:42 -0600, [EMAIL PROTECTED] wrote: Hi, I'm wondering whether there is GUI under linux. I checked the website, it has Emacs(ESS), IDE/Scrip Editors etc. I am looking for one which is similar to the GUI under windows. I am not sure that it is worthwhile at this point, but there is a GNOME based interface available under Linux. More information is available on page 16 of the R Administration Manual. Otherwise, I would strongly advise the use of ESS with either emacs or Xemacs under Linux. It has a bit of a learning curve, but as with R itself, you will wonder how you ever did without it. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
On Wed, 2005-02-02 at 16:17 +1300, Brett Stansfield wrote: can you recommend a good manual for R that starts with a data set and gives demonstrations on what can be done using R? I downloadedR Langauage definition and An introduction to R but haven't found them overly useful. I'd really like to be able to follow some tutorials using a dataset or many datasets. The datasets I have available on R are Brett, First, review the R Posting Guide at: http://www.r-project.org/posting-guide.html There are good pointers as to how to get help with R. The R Language Definition document is a reference, not a tutorial. You wouldn't read the OED to learn how to speak English right? If you have found the Intro To R document lacking in some fashion, there are other Contributed documents available at: http://cran.r-project.org/other-docs.html which is referenced in the Posting Guide. I would suggest starting with those. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] postscript symbols?
On Tue, 2005-02-01 at 18:48 -0800, [EMAIL PROTECTED] wrote: dear R wizards: is it possible to use a postscript font symbol as a plot symbol?in particular, I want to use the four postscript symbols for playing cards (club, heart, spade, diamond) as points. In LaTeX, these four are \Pisymbol{psy}{A7} \Pisymbol{psy}{A8} \Pisymbol{psy}{A9} \Pisymbol{psy}{A10} and what I would love to do is place them, at say, (x=1,y=1), (x=2,y=2), (x=3,y=3) and (x=4,y=4). Help appreciated---or merely a note that this is impossible. Ivo, This may not be exactly what you want, but... Using the Hershey vector fonts, you can plot (using text()) a variety of symbols. See ?Hershey and demo(Hershey) for more information. Here is an example: plot(0:5, 0:5, type = n) text(1:4, 1:4, vfont = c(sans serif, plain), labels = c(\\CL, \\DI, \\HE, \\SP), cex = 2) The set of escaped characters in the vector for the 'labels' argument are the codes for clubs, diamonds, hearts and spades, respectively. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
try http://cran.r-project.org/other-docs.html jon On Wed, 2 Feb 2005 16:17:35 +1300, Brett Stansfield [EMAIL PROTECTED] wrote: can you recommend a good manual for R that starts with a data set and gives demonstrations on what can be done using R? I downloadedR Langauage definition and An introduction to R but haven't found them overly useful. I'd really like to be able to follow some tutorials using a dataset or many datasets. The datasets I have available on R are __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html