Re: [R] Question about PCA with prcomp
On Mon, 02-Jul-2007 at 03:16PM -0400, Ravi Varadhan wrote: | Mark, | | What you are referring to deals with the selection of covariates, since PC | doesn't do dimensionality reduction in the sense of covariate selection. | But what Mark is asking for is to identify how much each data point | contributes to individual PCs. I don't think that Mark's query makes much | sense, unless he meant to ask: which individuals have high/low scores on | PC1/PC2. Here are some comments that may be tangentially related to Mark's | question: | | 1. If one is worried about a few data points contributing heavily to the | estimation of PCs, then one can use robust PCA, for example, using robust | covariance matrices. MASS has some tools for this. | 2. The biplot for the first 2 PCs can give some insights | 3. PCs, especially, the last few PCs, can be used to identify outliers. What is meant by last few PCs? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unix-like permissions to allow a user to update recommen
On Mon, 18-Jun-2007 at 10:25PM +0100, Ted Harding wrote: [] | I'm still wondering, though, why you don't just run the command | update.packages() as root. You have root access, and you said (in | the adding user to group context) that only one user is involved | (presumably yourself?). In that case, why not start R as root and | run update.packages()? That's probably slightly simpler than what I described. I never think of running R as root, so I never thought of that, but it's not as elegant as I'd have imagined. Since nobody has suggested a way of modifying the permissions to make what I was thinking of possible, perhaps it really isn't. Thanks for that suggestion. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Unix-like permissions to allow a user to update recommended packages
I installed R from the tar.gz file (as root) in a directory under /usr/local. The recommended packages are installed in a library in that directory whereas additional packages I install in a directory under the /home directory as a user. Updating the additional packages is very easy with update.packages() as a non-root user, but the recommended packages cannot be done so readily because of file permissions. My question is how do I set the permissions or ownerships in the /usr/local/R-2.5.0 directory so that everything necessary can be writable by a user? Should I make a group for R users (total of one member) or is it simpler than that? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unix-like permissions to allow a user to update recommen
On Mon, 18-Jun-2007 at 11:53AM +0100, Ted Harding wrote: | On 18-Jun-07 10:11:43, Patrick Connolly wrote: | I installed R from the tar.gz file (as root) in a directory under | /usr/local. The recommended packages are installed in a library in | that directory whereas additional packages I install in a directory | under the /home directory as a user. | | Updating the additional packages is very easy with update.packages() | as a non-root user, but the recommended packages cannot be done so | readily because of file permissions. | | My question is how do I set the permissions or ownerships in the | /usr/local/R-2.5.0 directory so that everything necessary can be | writable by a user? Should I make a group for R users (total of one | member) or is it simpler than that? | | Since you have root access, do you need to segregate the additional | packages to a particular user? It's handy to not have to reload packages that don't change between versions of the basic installation. | | Though I don't run R as root for general use, I always install/update | by running R CMD as root. This makes all of R (recommended and also | any extras) available system-wide, and no pemission problems arise. | | This of course does not stop you from setting up a special .Rprofile | for each user, since this by definition lives in the user's home | directory. | | Does this help? Or are there issues you haven't mentioned which make | such an approach not feasible? I don't exactly have issues. It's not a huge problem I'm dealing with. It's simple enough for me to use update.packages() as a user which will download the appropriate packages. Though they won't be installed, they are all in the one place in the /tmp/ directory from where I can install them as root. I just thought there must be a more elegant way to set permissions so that users could write to the subdirectories under /usr/local/R-2.xxx/. So much of the installation process of R and its packages is so elegant, I'd like to retain some of that elegance. best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Upgraded FC4 to FC5 - unable to start device X11 in R
On Sat, 16-Jun-2007 at 04:09PM +1200, Patrick Connolly wrote: | On Fri, 15-Jun-2007 at 01:50PM -0700, Li-Jung Liang wrote: | | | Hi, | | | | I upgraded my system from FC4 to FC5. So now I have R version 2.5.0 | | (2007-04-23). | | But I ran into a problem with starting device X11 (message below). | | | | X11() | | can't find X11 font | | Error in X11(display, width, height, pointsize, if (is.null(gamma)) 1 | | else gamma, : | | unable to start device X11 | | | | Any idea? | | Check what search() gives you. Make sure package:grDevices is on that | list. | | I ran into that problem myself. I never figured out how come it used | to be there, but suddenly ceased to be. The problem didn't appear | until R-2.5.0. In the USER-VISIBLE CHANGES under | CHANGES IN R VERSION 2.0.0, | I see this: | | o Package 'graphics' has been split into 'grDevices' (the graphics | devices shared between base and grid graphics) and 'graphics' | (base graphics). Each of the 'graphics' and 'grid' packages | load 'grDevices' when they are attached. Note that | ps.options() has been moved to grDevices and user hooks may | need to be updated. | | My suspicion is that grDevices did not have to be specifically loaded | if graphics was one of your default packages loaded at startup. Since | few others seem to have had the same experience, I'd hesitate to call | it a bug. I've got round the problem by adding grDevices to the list | in my ~/.Rprofile file. Perhaps I could explain what I meant to say better than that Starting R with the --vanilla switch will load graphics and the grDevices packages (among others). There seems to be a difference from previous versions if I use a ~/.Rprofile file to load the graphics package, since the grDevices does NOT automatically load whereas it did in R-2.4.x versions. That might be a bug, but since others don't seem to have the problem, I'd hesitate to say. In any case, if grDevices isn't in the search list, I'd be fairly certain you can get round the problem you describe by specifically loading it, or adding it to the startup list of packages. (I'm assuming you installed R from the tgz file and not an rpm). I, too, use Redhat/Fedora but other users don't seem to have the same problem, so it's likely something more specific to our setups. As ever, the more knowledgeable could have a better idea. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Upgraded FC4 to FC5 - unable to start device X11 in R
On Fri, 15-Jun-2007 at 01:50PM -0700, Li-Jung Liang wrote: | Hi, | | I upgraded my system from FC4 to FC5. So now I have R version 2.5.0 | (2007-04-23). | But I ran into a problem with starting device X11 (message below). | | X11() | can't find X11 font | Error in X11(display, width, height, pointsize, if (is.null(gamma)) 1 | else gamma, : | unable to start device X11 | | Any idea? Check what search() gives you. Make sure package:grDevices is on that list. I ran into that problem myself. I never figured out how come it used to be there, but suddenly ceased to be. The problem didn't appear until R-2.5.0. In the USER-VISIBLE CHANGES under CHANGES IN R VERSION 2.0.0, I see this: o Package 'graphics' has been split into 'grDevices' (the graphics devices shared between base and grid graphics) and 'graphics' (base graphics). Each of the 'graphics' and 'grid' packages load 'grDevices' when they are attached. Note that ps.options() has been moved to grDevices and user hooks may need to be updated. My suspicion is that grDevices did not have to be specifically loaded if graphics was one of your default packages loaded at startup. Since few others seem to have had the same experience, I'd hesitate to call it a bug. I've got round the problem by adding grDevices to the list in my ~/.Rprofile file. Others might have a better explanation, of course. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why might X11() not be found?
On Fri, 25-May-2007 at 08:25AM +1200, Patrick Connolly wrote: | sessionInfo() | R version 2.5.0 (2007-04-23) | x86_64-unknown-linux-gnu | | locale: | | LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C | | attached base packages: | [1] utilsstatsgraphics methods base Well, in fact it was very simple. There's no package:grDevices in there. Now, why that didn't happen before, I'm yet to work out. Thanks for the suggestions. best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Why might X11() not be found?
sessionInfo() R version 2.5.0 (2007-04-23) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] utilsstatsgraphics methods base other attached packages: lattice 0.15-5 I've recently moved to Fedora Core 6 and installed the latest R from the tar.gz file as I've done for some years now. The make check returned no errors that I could see so it came as a surprise to see this: plot(8) Error in plot.new() : could not find function X11 It's possible that there's something different from previous versions with the graphic card driver in this installation but I'm mystified why there didn't seem to be any problem detected (or perhaps, more to the point, reported) during the installation of R. Everything else I've tried to do seems to work, but I don't do a lot in R before there's a reason to draw plots, so I need to find out what's going on. Where do I need to look to work out what could have failed? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using R to create pdf's from each file in a directory
On Fri, 20-Apr-2007 at 11:10PM -0500, Jeffrey Horner wrote: | workdir - '/tmp/data' | for (x in dir(workdir,pattern='.csv$')){ |d - read.table(paste(workdir,'/',x,sep=''), sep=\t, header=TRUE) If they're CSV files, I don't think sep = \t will be correct. Try , best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dealing with data frame column names beginning with a numeric
On Mon, 16-Apr-2007 at 10:12PM +0100, Prof Brian Ripley wrote: | On Mon, 16 Apr 2007, Duncan Murdoch wrote: | The name change happens in the conversion to a dataframe, so why not | change the name afterwards? That is: | | df - data.frame(mat) | names(df)[3] - 5T | boxplot(df, main=blah blah blah) | | Or use | | boxplot(as.data.frame(mat)) | | which seems more natural than data.frame(mat, check.names=FALSE) (which | also does the job) or even data.frame(mat). boxplot(data.frame(mat)) is how it's described in the help, but it produces the problem that began my discussion (i.e. prepends an X to the name for a dataframe column name). However, boxplot(as.data.frame(mat)) as suggested by Brian works fine. So I needed only three keystrokes to get round the problem. Thank you all. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Dealing with data frame column names beginning with a numeric
I wish to set up a simple function using boxplot so that it will be available to someone using R for Windows. (I myself use Linux.) The way the data is organised makes it convenient to use the boxplot function in a manner similar to this example given in the help. mat - cbind(Uni05 = (1:100)/21, Norm = rnorm(100), + T5 = rt(100, df = 5), Gam2 = rgamma(100, shape = 2)) boxplot(data.frame(mat), main = boxplot(data.frame(mat), main = ...)) If one of those columns had a numeric beginning to its name, such as: colnames(mat)[3] - 5T and then using boxplot the same way, it will prepend an X to the column name 5T in the changing to a dataframe. I know I could use boxplot with a formula with the dataframe reshaped which would get round the problem, but I wanted to introduce as few new concepts as possible for someone new to using R. So the question is: Is there a way to get such a name without anything prepended into boxplot when used this way? I've been led to understand that some Windows' plotting devices lend themselves to simpler editing than in Linux, so perhaps there is a simple way to remove the X from the plot afterwards. I know it could be done with a postscript device by editing the file with a text editor but that's not simple with Windows. Ideas? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dealing with data frame column names beginning with a numeric
On Mon, 16-Apr-2007 at 04:29PM -0400, Gabor Grothendieck wrote: | Try this: | | boxplot(data.frame(mat), names = colnames(mat)) | Great! Now why didn't I think of that? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] converting a list to a data.frame
On Tue, 03-Apr-2007 at 01:55PM +0200, Dimitris Rizopoulos wrote: | try something like this: | | lis - list(c(1,2,4), c(4,5,2,1), c(3,4,6,3), c(3,1,76,4,2)) | ## | n.max - max(sapply(lis, length)) | val - NA # what to fill in | fill - function(x) c(x, rep(val, n.max - length(x))) | as.data.frame(do.call(rbind, lapply(lis, fill))) I think that should be cbind, not rbind. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] creating R packs for all
On Fri, 23-Mar-2007 at 06:00PM +, Prof Brian Ripley wrote: | On Fri, 23 Mar 2007, Erin Hodgess wrote: | | Dear R People: | | I am in the process of creating an R package via Windows. | | If I would decide to submit in to CRAN, what would I need to | do in order to make it run for the Linux or Mac People, please? | | If it passes R CMD check on Windows it should work anywhere. About | the only thing that is fussier on Unix than Windows is the use of | the correct line endings for C etc files. (OTOH, Windows adds | restrictions that 'R CMD check' checks for Unix users.) There are graphics functions that can be called in platform specific ways. Hard-wired coding that calls a default plotting device with unnamed arguments can make no sense on another platform. Using Linux, one gets: args(x11) function (display = , width = 7, height = 7, pointsize = 12, gamma = getOption(gamma), colortype = getOption(X11colortype), maxcubesize = 256, bg = transparent, canvas = white, fonts = getOption(X11fonts), xpos = NA, ypos = NA) Using Windows, the first argument is absent so code that assumes arguments are in the same order (say by not using names) irrespective of platform will fail even though R CMD check looks fine. Perhaps it could all be summed up by a general problem with hard-wired graphics calls (such as WMF files). From my limited experience they would not be that difficult to avoid. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hardware for a new Workstation for best performance using R
On Mon, 19-Mar-2007 at 07:23PM +0100, Peter Dalgaard wrote: | Thomas Lumley wrote: | On Thu, 15 Mar 2007, Andrew Perrin wrote: (in part) | | 2.) Yes, by all means you should use linux instead of windows. The | graphics output is completely compatible with whatever applications you | want to paste them into on Windows. | | | This turns out not to be the case. | | It is not trivial to produce good graphics off Windows for adding to | Microsoft Office documents (regrettably an important case for many | people). There has been much discussion of this on the R-sig-mac mailing | list, for example, where PNG bitmaps (at sufficiently high resolution) | seem to be the preferred method. | | -thomas | | | One option for people who are paying for software anyways is to install | Adobe Acrobat Writer software for generating PDF files from Word. This | also allows you to include ouput from the pdf() device, and the end | result comes out really nice. I've been told that there are also free PDF writers, so it's not necessary to spend money on Adobe Acrobat Writer. One example is http://www.cutepdf.com/ I personally find that PNGs are fine provided I know what final size is needed. PNGs certainly don't have the flexibility that Gabor mentions but they are usually as small as any other format. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] R in Industry
On Wed, 07-Feb-2007 at 07:07PM +1100, Jim Lemon wrote: | Matthew Keller wrote: | Far from flaming you, I think you made a good point - one that I | imagine most people who use R have come across. The name R is a big | impediment to effective online searches. As a check, I entered R | software, SAS software, SPSS software, and S+ software into | google. The R 'hit rate' was only ten out of the first 20 results (I | didn't look any further). For the other three software packages, the | hit rates were all 100% (20/20). | | I do wonder if anything can/should be done about this. I generally | search using the term CRAN but of course, that omits lots of stuff | relevant to R. Any ideas about how to do effective online searches for | R related materials? | | Try r stats. I get 18/20 on Google with that. Not bad, but the original question was about R related employment. Trying R jobs or R employment comes up with Hungarian girls looking for a job in Cork (I think the letter 'r' in 'Cork' that had that one show up) and somewhat further down the list comes a question about jobs that take a long time running MCMC using R in ESS. And somewhat further still before there's an R-help archive where someone asked a similar question to what started this thread. Not a lot of use. Trouble is now I've clicked on some of those, they'll rate higher on Google's ranking so I'm perpetuating the problem. Did anyone think of a search string that wasn't useless? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Wiki for Graphics tips for MacOS X
On Wed, 31-Jan-2007 at 12:11PM -0500, Gabor Grothendieck wrote: | To get the best results you need to transfer it using vector | graphics rather than bitmapped graphics: | | http://www.stc-saz.org/resources/0203_graphics.pdf | | There are a number of variations described here (see | entire thread). Its for UNIX and Windows but I think | it would likely work similarly on Mac and Windows: | | http://finzi.psych.upenn.edu/R/Rhelp02a/archive/32297.html I found that interesting, particularly this part: For example, on Linux do this: dev.control(displaylist=enable) # enable display list plot(1:10) myplot - recordPlot() # load displaylist into variable save(myplot, file=myplot, ascii=TRUE) Send the ascii file, myplot, to the Windows machine and on Windows do this: dev.control(displaylist=enable) # enable display list load(myplot) myplot # displays the plot savePlot(myplot, type=wmf) # saves current plot as wmf I tried that, but I was never able to load the myplot in the Windows R. I always got a message about a syntax error to do with ' ' but I was unable to work out what the problem was. I thought it was because the transfer to Windows wasn't binary, but that wasn't the problem. I was unable to get the thread view at that archive to function so I was unable to see if there were any follow ups which offered an explanation. R has changed quite a bit in the years since then, so it might be that something needs to be done differently with more recent versions. Has anyone done this recently? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] as.Date() results depend on order of data within vector?
On Sun, 07-Jan-2007 at 12:01PM +, Mark Wardle wrote: | Dear all, | | The as.Date() function appears to give different results depending on | the order of the vector passed into it. | | d1 = c(1900-01-01, 2007-01-01,,2001-05-03) | d2 = c(, 1900-01-01, 2007-01-01,2001-05-03) | as.Date(d1) # gives correct results | as.Date(d2) # fails with error (* see below) | | This problem does not arise if the dates are NA rather than an empty | string, but my data is coming via RODBC and I still don't have NAs | passed across properly. | | I might add that I initially noticed this behaviour when using RODBC's | sqlQuery() function call, and I initially had difficulty explaining why | one column of dates was passed correctly, but another failed. The | failing column was a date of death column where it was NA () for | most patients. | | I've come up with two workarounds that work. The first is to sort the | data at the SQL level, ensuring the initial record is not null. The | second is to use sqlQuery() with as.is=T option, and then do the sorting | and conversion afterwards. Simpler, I think, is to add one line d2[d2 == ] - NA I've not tested the idea extensively, so there might be occasions where it falls down. If you're working with a dataframe, you can use one of the apply functions to effect all columns. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] command option for R CMD BATCH
I wish to use R CMD BATCH to run a small R function which reads a text file and plots a single graph to a PDF file. version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) The text files are monthly data, (called lyrical names like October.txt or November.txt) and the end result of each run will be a PDF file called October.pdf, etc. It's simple enough to make a separate file for each month which has the command to call the R function, e.g. October.r would be plot.month(October.txt) and use it like so: R CMD BATCH October.r /dev/null (the R function creates the name for the PDF file) or slightly more elegantly, a one line shell script that takes an argument: R CMD BATCH $1.r /dev/null (so that the script name and the name of the month will make a PDF file for that month) What I'd like to do is avoid the need to make the Month.r files and have the script pass the month information directly to the function that a single .r file would call. If I brushed up on a bit of Perl, I might work out how to modify the shell script to do such a thing, but I suspect it should be simpler than that. I had thought of using litter for such a thing, but as I looked into it, I get the impression that's not the idea of litter. (I'm also a bit reluctant to recompile R.) Ideas welcome. Thanks -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] command option for R CMD BATCH
On Thu, 23-Nov-2006 at 02:44PM +, Prof Brian Ripley wrote: | Try this: | | gannet% cat month.R | x - commandArgs() | print(x[length(x)]) | | gannet% R --slave --args January month.R | [1] January That's exactly what I needed. Thank you Brian for a concise and thorough answer. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which executable is associated with R CMD INSTALL?
On Mon, 30-Oct-2006 at 04:44PM -0500, Duncan Murdoch wrote: | Try R CMD printenv R_HOME and you'll find which R home directory it is | using. You can see a lot more with R CMD printenv or various options | to R CMD config. Thanks for that information. It knocks my theory on the head. Pity that, because I might have been able to do something about it if that was the problem. Now I'm at a loss to work out why lme4 installation cannot find Matrix, and more strangely, why nothing else gave a similar problem. I think I've tried every version of lme4 and Matrix that has emerged since R-2.4.0 has been released. The fact that no other Red hat user has a problem indicates the problem is this end; but I'm short of ideas about where to look. Looks like it's back to versions 6 months old -- like proprietary software users have to put up with. :-( (This is not a complaint) -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Which executable is associated with R CMD INSTALL?
I'm still having trouble installing the lme4 package on RHEL 3. I've asked this list and it seems my problem is not universal. Brian Ripley indicated that the problem was with recognising the Matrix package, even though I've taken care to get the most recent versions of Matrix and lme4. It seems to me that the problem arises because the computer has a site installation of R-2.3.1 and I'm trying to use R-2.4.0 from my home directory. I use a symbolic link (named R) to point to the 2.4.0 executable. The only problem I've encountered is installing the lme4 package, and I'm now guessing that R CMD INSTALL is not using my link, and defaults to the R-2.3.1. Does my theory have any credibility? I know it wouldn't explain why the other packages don't have a problem, but I'm scraping the bottom of the barrel now. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Redhat compilers and lme4 with R-2.4.0
On Wed, 18-Oct-2006 at 09:35AM +0100, Prof Brian Ripley wrote: | There are no known problems with 'RedHat compilers' and lme4. | | You do need to have installed an up-to-date Matrix prior to lme4, and the | command-line you show indicates that you have not done so (or that it is | not in a library known to R_LIBS). I did Matrix immediately before trying lme4 but because I wasn't putting it in the default library, Dealing with that issue is different on the two machines, but they are essentially the same problem. Thank you for adding some wisdom to the information errors. Fairly obvious once you know, of course. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Redhat compilers and lme4 with R-2.4.0
I've tried unsuccessfully to install lme4 on two different Redhat systems but I've not noticed anything on this list to indicate anyone else has had similar problems. * Installing *source* package 'lme4' ... ** libs gcc -I/usr/local/R-2.4.0/include -I/usr/local/R-2.4.0/include -I/usr/local/include-fpic -g -O2 -std=gnu99 -c init.c -o init.o In file included from init.c:1: lme4_utils.h:4:20: error: Matrix.h: No such file or directory In file included from init.c:1: lme4_utils.h:14: error: syntax error before ��c�� lme4_utils.h:14: warning: type defaults to ��int�� in declaration of ��c�� lme4_utils.h:14: warning: data definition has no type or storage class init.c:44: error: syntax error before ��c�� ,,, etc, My first theory was that warnings given when the Matrix package was installed could indicate what was missing. However, I've been notified that the same errors don't prevent a Debian system installing lme4. Knowing that Redhat has previously fiddled with compilers before version 3, I'm now suspecting that something similar has been happening. Does this information tell anybody something informative about FC4's compiler (unchanged from installation)? $ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=x86_64-redhat-linux Thread model: posix gcc version 4.0.0 20050519 (Red Hat 4.0.0-8) The other system is RHEL 3 (32bit) but it gives a similar bunch of errors using an older compiler (3.0.3 IIRC) There must be others using Redhat and I'd be interested to know if/how you succeded installing lme4. I'm feeling left out of the 2.4.0 loop since I have to stay with 2.3.1 to use lme4, so I'd greatly appreciate any information anyone has. Thanks -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] [R-pkgs] New versions of Matrix and lme4 packages for R-2.4.0
On Tue, 03-Oct-2006 at 09:56AM -0500, Douglas Bates wrote: | Versions 0.9975-1 of the Matrix and lme4 packages will soon be available on | CRAN for use with R version 2.4.0 or later. How quickly things change!! When I got to look at CRAN, the latest versions were 0.9975-1 of lme4 and 0.9975-2 of Matrix which I tried. platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) Matrix installs, but with a number of warnings like these: Warning in matchSignature(signature, fdef, where) : in the method signature for function coerce no definition for class: matrix.csr Warning in matchSignature(signature, fdef, where) : in the method signature for function coerce no definition for class: matrix.csr When I try to install lme4, it fails with messages like these: *Installing *source* package 'lme4' ... ** libs gcc -I/usr/local/R-2.4.0/include -I/usr/local/R-2.4.0/include -I/usr/local/include-fpic -g -O2 -std=gnu99 -c init.c -o init.o In file included from init.c:1: lme4_utils.h:4:20: error: Matrix.h: No such file or directory In file included from init.c:1: lme4_utils.h:14: error: syntax error before ��c�� My guess is that the warnings from the Matrix installation were not irrelevant, and that the type of error would indicate to the cognoscenti[1] what could be missing in my installation. If the second part of my guess is not correct, I'll gladly supply more of the messages if the above is insufficient. Of course, I'm open to correction on the first part also. TIA 1. cognoscenti:- persons who have superior knowledge and understanding of a particular field, (http://dictionary.reference.com/search?q=cognoscenti) -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Using assign() function as I did in Splus
Years ago, when I used Splus, I used to do this sort of thing: assign(data, data, frame = 1) This was so that if the object data was used in, say a call to glm, and I wished to do a summary of the glm object, data wasn't otherwise visible. Since I moved to R, the lexical scoping has virtually eliminated the need to do that. However, I've been trying to use the package samm http://www2.dpi.qld.gov.au/fieldcrops/14715.html It seems to me to be developed for Splus and ported to R (and then mostly only for Windows). There is a binary version for Linux, but it's for R-1.9.x which means it's virtually useless. There's a huge number of functions in the package, and it's not easy to work out what's producing what error.very I suspect the problem isn't to do with using Windows instead of Linux which I'm used to. The only way I can make the required objects visible is to assign them to pos = 1 which means they're debris to be removed after the function finishes, and not a very elegant approach. There's probably something tricky to do with environments I'm not understanding here. If I could replicate the frame = 1 idea, I'd feel less of a klutz. What would be a better approach? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] R CMD INSTALL with debugging
I've run into a problem with lazy loading on a Linux system when trying to install the Matrix package (version 0.995-16) which didn't happen with version 0.995-2. The problem is not with a x86_64 system: it's a 32 bit machine, the exact description I don't have right now (R-2.3.1). The message looks like this: Error in match.call(fmatch, fcall) : unused argument(s) (x ...) In addition: There were 12 warnings (use warnings() to see them) Error: unable to load R code in package 'Matrix' Execution halted ERROR: lazy loading failed for package 'Matrix' I even tried with the --no-lazy switch but that only gave me a message about being deprecated but otherwise the results were identical. What do I need to do to get more information about what is making that match.call message? The warnings() message is of no use once R has exited. I suspect it has something to do with warnings about NULL environments being deprecated, because I've not tracked down all instances of them, and the newer Matrix package is more particular about such things. Finding what is producing the problem with match.call might help me work out where the NULL environment messages are coming from and that would be an added bonus. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to iteratively extract elements out of a list
On Sat, 26-Aug-2006 at 09:57AM +0100, Patrick Burns wrote: | sub.m - lapply(m, function(x)x[x2]) | sub.m | [[1]] | [1] 3 4 | | [[2]] | [1] 4 5 | | [[3]] | [1] 4 | | sub.m[unlist(lapply(sub.m, function(x) length(x) == 2))] | [[1]] | [1] 3 4 | | [[2]] | [1] 4 5 | | sub4.m - lapply(m, function(x)x[x4]) | sub4.m[unlist(lapply(sub4.m, function(x) length(x) 0))] | [[1]] | [1] 5 Or slightly shorter in this case: sub.m[sapply(sub.m, function(x) length(x) == 2)] etc. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Colours in silhouette plots (cluster package)
I tried using colours in silhouette plots by specifying a vector of colours instead of the default gray for the col parameter. No bars are drawn, though the rest of the plot works as it did with the grey bars. On investigating cluster:::plot.silhouette, I came across this part: if (do.col.sort (lc - length(col)) 1) { if (lc == k) col - col[cli] else if (lc != n) col - rep(col, length = n) col - rev(col[attr(x, iOrd)]) } Since attr(x, iOrd) was NULL, I would end up with an empty col vector which explained why I didn't get any bars. When I removed [attr(x, iOrd)], the plot worked how I think it's meant to. The silhouette object I used was created from one obtained from the pam function in the same package. I've not tried plotting other types, so I can't say how general the phenomenon could be. Could it be that the iOrd part belongs when some other conditions apply or is it some left over code from a previous version? Or is it just that I've done something silly? platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) Along with cluster with that distribution: Packaged: Wed May 17 09:56:22 2006; maechler Built: R 2.3.1; x86_64-unknown-linux-gnu; 2006-06-05 11:57:15; unix best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] How does biplot.princomp scale its axes?
I'm attempting to modify how biplot draws its red vectors (among other things). This is how I've started: Biplot - function(xx, comps = c(1, 2), cex = c(.6, .4)) { ## Purpose: Makes a biplot with princomp() object to not show arrows ## -- ## Arguments: xx is an object made using princomp() ## -- scores - xx$scores[, paste(Comp, comps, sep = .)] loadings - xx$loadings[, paste(Comp, comps, sep = .)] plot(range(scores), range(scores), xlab = , ylab = , xaxt = n, yaxt = n, pch = ) text(scores[,1], scores[,2], rownames(scores), cex = cex[1]) axis(2) axis(1) } I can make part of a biplot using that function with the USArrests data: Biplot(princomp(USArrests, cor = TRUE), c(1,2), cex = c(.6, .4)) Compare that with what we get using biplot.princomp: biplot(princomp(USArrests, cor = TRUE), c(1,2), cex = c(.6, .4)) It seems to me that the y-values are the same in both plots, but some sort of scaling on the x-axis is happening. Something similar seems to happen with the loadings as well. I notice in the documentation for biplot, mention is made of ... many variations on biplots. Would I be doing something inexcusable if I ignored the differences I've noticed here? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] use of NULL environment is deprecated?
] version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) I see in the NEWS file the line: o Use of NULL as an environment is deprecated and gives a warning. Which duly happens. I get warnings like this: Warning message: use of NULL environment is deprecated My problem is that I don't know what is being referred to. A little birdie tells me that in later versions of R, those warnings will become errors so I need to work out where they're coming from before I can use later versions. My question is: How does one work out which is being referred to by such a message? The traceback() function is useful when failure occurs. Is there an analagous way of looking into warnings? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] use of NULL environment is deprecated?
On Tue, 11-Jul-2006 at 06:41PM -0400, Duncan Murdoch wrote: [] | | options(warn=2) will convert warnings into errors, so traceback will work. | | A common situation where I've seen that error is with binary saves from | earlier versions of R being loaded into current versions. For example, | if you installed a package before, but didn't re-install it with 2.3.1, | or if you are reloading a workspace saved in an earlier version. Thank you for the explanation. In this case, it's the latter reason: the workspace comes from a different computer as well as a different version of R. Will saving the objects anew overcome the problem? (Thanks Sundar also.) -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Address of FactoMineR package author
I've tried to contact the author of part of the FactoMineR package which was given as: [EMAIL PROTECTED] However, the cedilla is not liked by any mail system I have access to, so that address is a non-starter. I tried using a simple letter 'c' which didn't cause a syntax error, but achieved nothing else. Could it just be that the address was correct and it's the season in France for people to be away and so not answering email? Or is there something I should know about such characters in email addresses? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Very slow read.table on Linux, compared to Win2000 [Broad cast]
On Wed, 28-Jun-2006 at 04:43PM -0700, Alberto Murta wrote: | I have a pentium 4 pc with 256 MB of RAM, so I made a text file, tab | separated, with column names and 15000 x 483 integers: | | system(ls -l teste.txt) | -rw-r--r-- 1 amurta amurta 16998702 Jun 28 16:08 teste.txt | | the time it took to import it was around 15 secs: | | system.time(teste - read.delim(teste.txt)) | [1] 15.349 0.244 16.597 0.000 0.000 | | so I think lack of RAM must not be the main problem. | Cheers | | Alberto | | | version |_ | platform i386-unknown-freebsd6.1 | arch i386 | os freebsd6.1 | system i386, freebsd6.1 | status | major 2 | minor 3.1 | year 2006 | month 06 | day01 | svn rev38247 | language R | version.string Version 2.3.1 (2006-06-01) Doesn't tell us about your window manager. I'd suspect you're using a light one. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] princomp and prcomp confusion
When I look through archives at https://stat.ethz.ch/pipermail/r-help/2003-October/040525.html I see this: Liaw, Andy wrote: In the `Detail' section of ?princomp: princomp only handles so-called Q-mode PCA, that is feature extraction of variables. If a data matrix is supplied (possibly via a formula) it is required that there are at least as many units as variables. For R-mode PCA use prcomp. It doesn't appear that anyone disputed the accuracy of it. My current installation (version.string Version 2.3.1 (2006-06-01)) says in the detail of princomp 'princomp' only handles so-called R-mode PCA, that is feature extraction of variables. If a data matrix is supplied (possibly via a formula) it is required that there are at least as many units as variables. For Q-mode PCA use 'prcomp'. I've not been following principal components and have only recently had a use for that methodology. Am I to assume that the later version is the correct one? I thought I'd worked out what the distinction between R-mode and Q-mode was, but now I'm as confused as ever. best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Regex engine types
version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R grep([W-Z], LETTERS, value = TRUE) [1] W X Y Z That's what I'd have expected. grep([W-Z], letters, value = TRUE) [1] x y z Not what I'd have thought. However, grep([B-D], letters, value = TRUE, perl = TRUE) character(0) So what is it that standard regular expressions use that's different from Perl-type ones? The help file for grep refers to POSIX 1003.2 which looked a bit daunting to delve into. From my limited reading, it seems there are different gegex Engine Types which seems to be getting somewhat tangential to what I was working on. I could probably avoid problems if I always set perl=TRUE, but it would be good to know what basic and extended regular expressions do that's different. If someone has a quick line or two describing it, I'd be interested to know. Thanks -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] weights argument in the lmer function in lme4
I suspect the weights argument is not having any effect. Package: Matrix Version: 0.995-2 Date: 2006-01-19 Beginning with this: Browse[1] resp.lmer - lmer(SensSSC ~ Block + Season + (1 | Plot) + (1 | Ma) + (1 | Pa) + + (1 | MaPa), weights = SensSSC.N, data = xx) I group the output into a table with my ran.eff function and get this: Browse[1] ran.eff(resp.lmer) 01 02 03 04 05 06 07 GCAf RankF A 13.714 13.709 13.886 14.124 15.120 13.546 14.586 0.472 1 B 13.452 NA 13.426 13.632 14.439 13.512 13.713 0.069 3 C 13.922 13.770 14.353 NA 14.661 13.529 14.367 0.453 2 D NA NA 13.353 NA NA NA NA -0.051 4 E 12.775 12.767 12.823 12.767 14.036 12.631 13.645 -0.495 6 F 13.043 13.338 12.641 12.977 13.848 12.425 13.530 -0.448 5 GCAm -0.200 -0.169 -0.165 -0.103 0.736 -0.428 0.329 NANA RankM 6.000 5.000 4.000 3.000 1.000 7.000 2.000 NANA Despite any shortcomings in my ran.eff function, those values look alright, but they're the same (to any number of decimal places) as I'd get without a weights argument. Just to check that the weights really don't effect it, I tried using only the rows with a weight of 5 (almost 90% of the data) but it was substantially different. Browse[1] resp.lmer5 - lmer(SensSSC ~ Block + Season + (1 | Plot) + (1 | Ma) + (1 | Pa) + + (1 | MaPa), subset = SensSSC.N == 5, data = xx) Browse[1] ran.eff(resp.lmer5) 01 02 03 04 05 06 07 GCAf RankF A 13.435 13.349 13.595 13.914 14.722 13.161 14.414 0.345 2 B 13.068 NA 13.110 13.447 14.121 13.296 13.637 -0.014 4 C 13.702 13.537 14.256 NA 14.371 13.575 14.247 0.469 1 D NA NA 13.276 NA NA NA NA -0.001 3 E 12.717 12.659 12.786 12.719 13.642 12.659 13.556 -0.425 6 F 13.015 13.101 12.549 12.920 13.629 12.438 13.474 -0.374 5 GCAm -0.210 -0.230 -0.146 -0.049 0.596 -0.353 0.391 NANA RankM 5.000 6.000 4.000 3.000 1.000 7.000 2.000 NANA That seems to indicate that weights cannot be readily ignored. Has anyone had experience to indicate that the weights argument does produce a difference, and so I should be looking somewhere else for the reason why I'm getting such results? 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] Canonical Variance Analysis by any other name?
On Thu, 19-Jan-2006 at 08:35AM +, Prof Brian Ripley wrote: | Canonical variates or canonical variance? | It was canonical variance I was asked about and I wasn't careful enough getting the Genstat quote to make sure I was referring to the same thing. It seems SAS uses the term Canonical Variance Analysis and the reference mentioned for it is: Dixon, W. H., and M. B. Brown [eds.]. 1979 Biomedical computer programs P-series. University of California Press, Los Angeles, CA. Does anyone know for sure if they are the same thing? It appears to me that someone misheard variates as variance, but that might not be the case. Perhaps SAS likes to use different terminology. Thank you Brian for the wikipedia link. It doesn't have anything relating to canonical variance analysis which seems to support my suspicions. -- 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] Canonical Variance Analysis by any other name?
I've been asked about Canonical Variance Analysis (CVA). I don't see any reference to it searching the R site. Does it go by other names? Genstat describes it thus: Canonical variates analysis operates on a within-group sums of squares and products matrix, calculated from a set of variates and factor that specifies the grouping of units. It finds linear combinations of the variates that maximize the ratio of between-group to within-group variation, thereby giving functions that can be used to discriminate between the groups. It's probably not particularly difficult to do, so I suspect someone has a package for doing it. What other name might I search for? Thnx -- 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] Space between axis label and tick labels
On Wed, 11-Jan-2006 at 10:52AM +0100, Kare Edvardsen wrote: | I'm writing an publication in two column format and need to shrink some | plots. After increasing the axis labels it does not look nice at all. | The y-axis label and tick labels almost touch each other and the x-axis | tick labels expand into the plot instead of away from it. Is there a | better way than cex to control the: | | 1) font size of axis and tick labels | | 2) font thickness | | 3) placement of both axis and yick labels Try ?par and check out what it has to say about cex.axis and cex.lab. Without any example code, I'm not clear on what you've tried, but you might need to check out the axis function as well. HTH -- 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] Age of an object?
On Wed, 14-Dec-2005 at 08:37AM -0400, Kjetil Brinchmann Halvorsen wrote: | Philippe Grosjean wrote: | Martin Maechler wrote: | Trevor == Trevor Hastie [EMAIL PROTECTED] | on Tue, 13 Dec 2005 12:51:34 -0800 writes: | | Trevor It would be nice to have a date stamp on an object. | | One way to do this with important objects is to use the comment function | (in package base) | | comment(myobj) - made last sunday of 2005 That's the beginning of the approach I used to produce a view of a working directory that looks like this: ObjectMode Rows Cols LenDate 1 lme.gca.testB function ---- 1 05/12/2005 2 lme.gca.testB2 function ---- 1 05/12/2005 3 last.warninglist ---- 1 01/12/2005 4 lme.gca.testB3 function ---- 1 01/12/2005 5 pedigree.gold function ---- 1 01/12/2005 6 kin.mat numeric 4444 1936 17/11/2005 7 kin.matrix numeric 1313 169 17/11/2005 8 pedigree.goldA function ---- 1 15/11/2005 9 goldPed.df dataframe 446 6 11/11/2005 10 plot.pedigree function ---- 1 11/11/2005 11 Plot.pedigree2 function ---- 1 11/11/2005 12 every character ----43 10/11/2005 13 femaleTree character ---- 1596 10/11/2005 14 lme.gca.test2 function ---- 1 10/11/2005 15 maleTreecharacter ---- 2084 10/11/2005 I keep a file that I can source one line at a time using ESS to rerun any of the objects. Typically, there will be data entry error repairs to text files used to produce dataframes (no change to the script), or I'll update a function with better thinking. That date can be useful information months or years later. Some of my local functions are nearly 10 years old and the date on them gives me an idea of how knowledgable I might have been at the time I last updated it. For me, it's extremely useful and I find it cumbersome to work on a system that doesn't have that functionality (particularly if it doesn't have ESS either). My approach does quite a bit more than adding a date and might be boring to most of the list since it is somewhat involved and convoluted, so I won't go into how it works here. I'm sure it could be made more elegant (say, using some of the ideas Duncan and Martin mentioned). If anyone is keen to develop something along these lines, I'll gladly provide ideas. best -- 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] R is GNU S, not C.... [was how to get or store .....]
On Tue, 06-Dec-2005 at 01:00PM +, Adaikalavan Ramasamy wrote: | Yes, it drives me mad too when people use = instead of - for | assignment and suppress spaces in an naive attempt for saving space. | | As an example compare | | o=fn(x=1,y=10,z=1) | | with | | o - fn( x=1, y=10, z=1 ) Or better still: o - fn(x = 1, y = 10, z = 1) The effect is more marked when the arguments are whole words rather than the single letter names in this example. Compare o - fn(xena = log, yacht = 10625, zebra = green) with o - fn( xena=log, yacht=10625, zebra=green ) | | Regards, Adai | | | | On Tue, 2005-12-06 at 13:43 +0100, Martin Maechler wrote: | vincent == vincent [EMAIL PROTECTED] | on Tue, 06 Dec 2005 11:09:36 +0100 writes: | | vincent shanmuha boopathy a écrit : | a-function(a,b,c,d) | { | k=a+b | l=c+d | m=k+l | } | | in this example the function will return only the value of m | ...But I like to extract the values of l k also. | which command to use for storing or for extracting those intermediate value... | | vincent may I suggest, inside your function | | vincent res = c(k, l, m); | vincent return(res); | | please, please, these trailing ; are *so* ugly. | This is GNU S, not C (or matlab) ! | | {and I have another chain of argments why - is so more | expressive than = but I'll be happy already if you could | drop these ugly empty statements at the end of your lines... | | vincent # also ... read some intro docs ! | | __ | 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 -- 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] R is GNU S, not C.... [was how to get or store .....]
On Tue, 06-Dec-2005 at 04:21PM +, Patrick Burns wrote: | I don't put in extraneous ';' because I maybe get a | blister on my little finger. | | I suspect that those who find the semi-colons ugly in | R do not find them ugly in C. Nor in perl, mysql or php. I quite like how R is rather different from those other languages. Somehow that very different look helps to change (me at least) into the appropriate type of thinking. It's somewhat akin to the difference between English and German use of capital letters -- each system makes perfect sense in its own context and are beter not mixed. -- 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] behavior of names
On Tue, 06-Dec-2005 at 04:14AM +, Ben Bolker wrote: | | I find the following ways in which | R attempts to preserve names to | be puzzling and often annoying | | x = c(a=1,b=2,c=3) | c(d=x[a],e=x[b]) | | # d.a e.b | # 1 2 | list(d=x[a],e=x[b]) | | # $d | # a | # 1 | | # $e | # b | # 2 | | (a real-world example: I fit | some parameters with mle(), ending | up with a named vector of coefficients, | and then want to use some or all of | those coefficients as input to another | mle() call -- I have to remove the | names manually.) | | Can anyone suggest why this happens/ | why it is a good design/whether there | are simple workarounds? Makes perfect sense to me. It's good to know where elements of lists came from. For dealing with the vector, you could do this: xv - c(x[a],x[b]) names(xv) - c(d, e) Not so simple with the list list(d=as.vector(x[a]),e=as.vector(x[b])) HTH -- 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] Tidiest way of modifying S4 classes?
I wish to make modifications to the plot.pedigree function in the kinship package. My attempts to contact the maintainer have been unsuccessful, but my question is general, so specifics of the kinship package might not be an issue. My first attempt was to make a new function Plot.pedigree in the .GlobalEnv which mostly achieved what I wanted to. However, I'm sure that's not the tidiest way to do it. We don't have the green book, but there's lots of interesting information I found here: http://www.stat.auckland.ac.nz/S-Workshop/Gentleman/S4Objects However, there's something I'm missing in connecting that information into knowledge of how I go about making a new method or slot or whatever is sensible in this case. What does one make of this: getClass(class(kinship:::plot.pedigree)) No Slots, prototype of class function Extends: OptionalFunction, PossibleMethod Known Subclasses: Class MethodDefinition, from data part Class genericFunction, from data part Class functionWithTrace, from data part Class derivedDefaultMethod, by class MethodDefinition Class MethodWithNext, by class MethodDefinition Class SealedMethodDefinition, by class MethodDefinition Class standardGeneric, by class genericFunction Class nonstandardGenericFunction, by class genericFunction Class groupGenericFunction, by class genericFunction If I want a new plot.pedigree function, do I make a slot, or what is the approach to take? Suggestions most welcome. 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
Re: [R] question about precision, floor, and powers of two.
On Fri, 04-Nov-2005 at 04:58PM +0100, Peter Dalgaard wrote: | In this particular case, it is slightly odd that we can't get an exact | answer for operations that could in principle be carried out using | integer arithmetic, but we're actually calculating log(8)/log(2). | | (Curiously, the same effect is not seen on Linux or Solaris until | | log2(2^29)-29 | [1] 3.552714e-15 Until is not quite the word: x - 2:100 data.frame(x, D = log2(2^x) -x) xD 12 0.00e+00 23 0.00e+00 34 0.00e+00 45 0.00e+00 56 0.00e+00 67 0.00e+00 78 0.00e+00 89 0.00e+00 9 10 0.00e+00 10 11 0.00e+00 11 12 0.00e+00 12 13 0.00e+00 13 14 0.00e+00 14 15 0.00e+00 15 16 0.00e+00 16 17 0.00e+00 17 18 0.00e+00 18 19 0.00e+00 19 20 0.00e+00 20 21 0.00e+00 21 22 0.00e+00 22 23 0.00e+00 23 24 0.00e+00 24 25 0.00e+00 25 26 0.00e+00 26 27 0.00e+00 27 28 0.00e+00 28 29 3.552714e-15 29 30 0.00e+00 30 31 3.552714e-15 31 32 0.00e+00 32 33 0.00e+00 33 34 0.00e+00 34 35 0.00e+00 35 36 0.00e+00 36 37 0.00e+00 37 38 0.00e+00 38 39 7.105427e-15 39 40 0.00e+00 40 41 0.00e+00 41 42 0.00e+00 42 43 0.00e+00 43 44 0.00e+00 44 45 0.00e+00 45 46 0.00e+00 46 47 7.105427e-15 47 48 0.00e+00 48 49 0.00e+00 49 50 0.00e+00 50 51 7.105427e-15 51 52 0.00e+00 52 53 0.00e+00 53 54 0.00e+00 54 55 7.105427e-15 55 56 0.00e+00 56 57 0.00e+00 57 58 7.105427e-15 58 59 7.105427e-15 59 60 0.00e+00 60 61 0.00e+00 61 62 7.105427e-15 62 63 0.00e+00 63 64 0.00e+00 64 65 0.00e+00 65 66 0.00e+00 66 67 0.00e+00 67 68 0.00e+00 68 69 0.00e+00 69 70 0.00e+00 70 71 0.00e+00 71 72 0.00e+00 72 73 0.00e+00 73 74 0.00e+00 74 75 0.00e+00 75 76 0.00e+00 76 77 0.00e+00 77 78 1.421085e-14 78 79 0.00e+00 79 80 0.00e+00 80 81 0.00e+00 81 82 0.00e+00 82 83 0.00e+00 83 84 0.00e+00 84 85 0.00e+00 85 86 0.00e+00 86 87 0.00e+00 87 88 0.00e+00 88 89 0.00e+00 89 90 0.00e+00 90 91 0.00e+00 91 92 0.00e+00 92 93 1.421085e-14 93 94 1.421085e-14 94 95 1.421085e-14 95 96 0.00e+00 96 97 0.00e+00 97 98 0.00e+00 98 99 0.00e+00 99 100 0.00e+00 Is there a pattern? -- 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] kinship package example data
I've been looking at the kinship package which looks as though it might be appropriate for my purposes. What I can't find is any reference to the data that is used in the example code. A dataframe called d10 with column names, upn, dadid, momid, sex and affect is required. One can get an idea of what sort of values should be in most columns from the description in the pedigree function, but I don't see anything to indicate what upn should look like. My efforts to contact the package maintainer have been unsuccessful, so this is a request to anyone who has used kinship to let me know if there is a real dataframe called d10, and if not, what sort of relationship does upn have to the dadid and momid? Thank you. -- 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] kinship package example data
On Sun, 06-Nov-2005 at 03:46PM -0500, Gabor Grothendieck wrote: | You might look through the tests/testcoxme subdirectory. Maybe | the file called cdata.dput ? Close, but not quite. However, it got me looking in the right place. It's in the tests/testpedigree directory. Thank you for the hint. -- 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] Subsetting a list
On Wed, 19-Oct-2005 at 05:09PM +0200, Martin Maechler wrote: | Lists can have 'dim' attributes and hence be treated as arrays; | Note that this is pretty rarely used and not too well supported | by some tools, one could say even 'print()' : | | set.seed(0); L0 - L - lapply(rpois(12, lambda=3), seq); dim(L) - 3:4; L | [,1] [,2] [,3] [,4] | [1,] Integer,5 Integer,3 Integer,5 Integer,3 | [2,] Integer,2 Integer,5 Integer,6 1 | [3,] Integer,2 Integer,2 Integer,4 Integer,2 for an occasion such as this, it can be clearer to do: transform(L) X1X2 X3 X4 1 1, 2, 3, 4, 5 1, 2, 31, 2, 3, 4, 5 1, 2, 3 2 1, 2 1, 2, 3, 4, 5 1, 2, 3, 4, 5, 6 1 3 1, 2 1, 2 1, 2, 3, 41, 2 best -- 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] high resolution images for publication
On Thu, 13-Oct-2005 at 05:33PM -0500, Marc Schwartz (via MN) wrote: | On Thu, 2005-10-13 at 15:20 -0600, Chris Buddenhagen wrote: | Dear all | | I am using R to produce ordinations library(vegan) and the plot function | produced looks great on the screen but when I send it to jpg or pdf or eps | the resolution is not so good. Can you tell me how to get high resolution | images out of R for publication? | | It would be helpful to see the actual code that you are using, as is | asked for in the Posting Guide. | | For publication, it would be rare to want to use a bitmapped format such | as jpg/png. 300 dpi PNGs work quite well in my experience, and not many will take PDF. It helps if you know what size they're to end up and make plots accordingly to avoid any need to resize. JPGs are good for photographs, but not for line work. | | pdf and eps are vector based formats and would be generally preferred | over the above. For publishers who insist on TIFF format, it should be noted that despite the fact that they're very large, they compress well and can be decompressed by the publisher. best -- 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] Lattice key seems to ignore the key list
I've never had this problem before and can't see what could be different from other times I've used keys with lattice. It appears that auto.key is being taken as TRUE when I specify a key list. The list I specify seems to be ignored. Where can I place a browser to figure out what is going on? Having made a list key.symbol from trellis.par.get, and specified a scales list and a between list, and a formula object (form), I use xyplot like this: xyplot(form, data = xx, groups = Entry, layout = c(8,8, 1), par.strip.text = list(cex = .65), between = between, scales = scales, panel = function(x, y, ...) panel.superpose(x, y, ...), key = list(points = Rows(key.symbol, 1:4), text = list(levels(xx$Entry), space = right, columns = 1)) ) What is implied in there that would set auto.key to TRUE? The space and columns part of the list seems to be ignored and the autokey values substituted. Ideas, please. 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
Re: [R] barplots - text direction
On Wed, 24-Aug-2005 at 01:54PM +1200, David Scott wrote: | On Wed, 24 Aug 2005, Murray Pung wrote: | | If the variable names are too long to allow room for each to be displayed on a barplot, how can the direction of the text be changed? | | a - cbind(2.4,2.4,2.5,2.6,2.6,2.6,2.6,2.6,2.9,2.9,2.9) | b - cbind(2.3,2.5,2.4,2.2,3.2,2.4,2.9,2.6,2.9,3.0,2.8) | h - rbind(a,b) | colnames(h) - c(one,two,three,four,five,six,seven,eight,nine,ten,eleven) | rownames(h) - c(Pre-stage,Post-stage) | barplot(h, beside = T, legend = colnames(g), horiz = T, xlim = c(0, 5)) | | | | barplot(h, beside = T, legend = colnames(h), horiz = T, xlim = c(0, 5), | las=1) | | will do it. | | Note: colnames(h) not colnames(g) And note that rownames(h) will give a more sensible legend. -- 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: [ESS] Re: [R] Strange characters in 2.1.0?
On Wed, 08-Jun-2005 at 11:20AM +0200, Martin Maechler wrote: | PaCo == Patrick Connolly [EMAIL PROTECTED] | on Wed, 8 Jun 2005 11:31:44 +1200 writes: | | PaCo On Tue, 07-Jun-2005 at 04:10PM +0200, Martin Maechler wrote: | PaCo | Dan == Dan Bolser [EMAIL PROTECTED] | | PaCo | .. | PaCo | | PaCo | Dan I have gone back to 2.0.0 :) | PaCo | | PaCo | Don't do that! | PaCo | You've lost tons of nice new features and gained quite an amount | PaCo | of old bugs by downgrading .. | | PaCo I get the non-generic quotes to show on the screen, but they won't | PaCo print with enscript. I end up with a lot of wrapped lines and | PaCo nonsense where an unknown character should be. | | Why is this diverted from R- to ESS-help? I erroneously thought that I could see the quotes only within Emacs and not in a terminal window, so I thought it was half way there with Emacs but not started in a terminal. I'll check more carefully henceforth. [...] | If I were in New Zeeland and would not need accents or umlauts, | I'd probably stick with latin1 (and would make sure my X | server got proper non-utf8 fonts) for another year or so. Thanks for the clarification. -- 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] reading non-existing files
On Tue, 07-Jun-2005 at 09:48AM -0700, Dave Evens wrote: | | Dear all, | | I'm trying to read to a collection of files in a loop | using odbcConnectExcel - but not all of the files | exist. This is the code I have Try try(). Use a condition on what you get back to avoid attempting to do things to empty files. ?try will be a good place to start. -- 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] R GUI for Linux?
On Mon, 30-May-2005 at 08:29PM +0200, Sander Oom wrote: | .. I have | given up on any instructions that tell me to run 'make'. Linux | distributions are just to[o] idiosyncratic for it to be worth the effort. That might be true of Linux distributions in general, but installing R is *very* easy. There are a couple of lines you can paste from the README file to get the configure and make thing working. Depending on your machine, it might take some time to do all its stuff which is extensive and thorough. Installing ESS is only slightly different. Simply extract the tar.gz file, find the README file and adjust your .emacs file to let it know where you've installed ESS. Granted, it does take a bit to get used to the way Emacs does things, but you need only about 1% of its capability and then it is extremely easy to use. Many questions asked on this list just don't arise. best -- 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] lme4 package and importIntoEnv errors
On Tue, 24-May-2005 at 08:40AM -0500, Douglas Bates wrote: | Perhaps I can add a bit more explanation. As Deepayan mentioned, the | versions of the lme4 package are closely linked to the versions of the | Matrix package. The R code for lmer is in the lme4 package but the | corresponding C code is in the Matrix package where it can gain access | to other C functions for sparse matrix manipulation. Thanks for that explanation. I was curious to know why it's so different from other packages I've had no trouble with. My problem did, indeed, arise from using an older version of lme4 with a new version of Matrix. Douglas's post explains why lme4_0.95-8.tar.gz is so much smaller than lme4_0.8-2.tar.gz. I feel much less confused now. Thank you Renaud Lancelot and Deepayan Sarkar also. -- 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] lme4 package and importIntoEnv errors
I've used packages for some years now and seldom had any trouble using the tgz files. Now I've come across something I've never seen before. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R library(lme4) Loading required package: methods Loading required package: Matrix Loading required package: latticeExtra Error in importIntoEnv(impenv, impnames, ns, impvars) : objects coef, coef-, corMatrix, matrix-, pdFactor, pdMatrix are not exported by 'namespace:Matrix' Error: package/namespace load failed for 'lme4' The Matrix and latticeExtra were downloaded and installed yesterday and the methods is what came with R-2.1.0. I notice in the archives someone had a very similar problem with version 2.0.1 and Windows in January this year, but there's no further mention that I found. That one seems to have been fixed with new Matrix and latticeExtra packages. However, I'm using newer ones already. So I thought it might have to do with 2.1.0 rebreaking something. 'CHANGES IN R VERSION 2.1.0 patched' doesn't make any mention of importIntoEnv, so I figured patching wasn't likely to make a difference. I also figured that latticeExtra is not likely to be as buggy as that. The only thing I can think of that would be slightly non-standard about my installation is the fact that I install packages (in addition to the recommended ones) in a different place from the normal ones. Could that be a source of error on this system? Alternatively, is there anything I could do about this namespace business? best -- 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] Bias to do with search engines
On Wed, 18-May-2005 at 02:55PM -0700, [EMAIL PROTECTED] wrote: | | First, a disclaimer. I am not affiliatied with the SAMM package. I am | only a user of the package, but I have been contacted (off list) by people | requesting information about SAMM and so I am posting this information | here. | | SAMM is software for fitting mixed models. Versions are available for | both S-Plus and R. More information and downloads of the software (and | manual) are available here: |http://www.dpi.qld.gov.au/fieldcrops/14715.html | This URL appears not to be indexed by Google, which is part of the reason | I am posting this. Old timers who haven't forgotten about AltaVista will be able to find it -- though it's still only 4th on the list even when I did a search for the string Spatial Analysis Mixed Models. What's more, the word spatial doesn't even appear in the three that are listed before it. Somehow, southern hemisphere sites aren't taken as seriously as those from that other hemisphere. Is there a word for that type of bias? -- 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] R2.1.0: X11 font at size 14 could not be loaded
On Thu, 28-Apr-2005 at 05:25PM -0400, Xiang-Jun Lu wrote: | Hi, | | I have just noticed the following problem with R2.1.0 running on SuSE 9.1, | [However, version 2.0.1 (2004-11-15) on the same machine works Okay]: | | - | hist(rnorm(100)) | Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) : | X11 font at size 14 could not be loaded | version | _ | platform i686-pc-linux-gnu | arch i686 | os linux-gnu | system i686, linux-gnu | status Patched | major2 | minor1.0 | year 2005 | month04 | day 20 | language R | - | | Any insight? Works fine with mine. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R Something to do with the patch, perhaps? -- 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] Control of vertical spacing in Lattice key text?
I find the key and legend functions in Lattice very useful. Trouble is, now I can see what else I'd like to be able to do with them. If I put a title on a key, it appears too close to the key itself, and if there's a line break in the title (which often happens), the leading between the lines is too much. What I can do is print to a postscript file, then find the lines in the postscript file where my text appears and fiddle with the postscript code to move the text up or down as I wish. For single plots that's OK, but I'd prefer to be able to do it within R especially when I wish to do dozens of them. Is there something in the documentation I overlooked? 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] help on deleting NAs
On Fri, 18-Feb-2005 at 03:41PM -0600, [EMAIL PROTECTED] wrote: | Thanks a bunch. | | I happened to generate another dataset to try the command you all | provided. my.data$group is factor and so the !my.data$group command | doesn't work but the !with statement works for both situation. So what i | can modify and make the first one work, just curious. Try an as.character() with the factor. HTH -- 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] Lattice tick labels not all appearing
Recently I've encountered a phenomenon that can be illustrated thus: bwplot(runif(45)*100) Depending on the random seed, one or other or both of the outer tick labels are not labelled, even though there'd be heaps of space to do so. The same happens with the postscript device. I can get them both to appear if I add an excessive xlim parameter like so: bwplot(runif(25)*100, xlim = c(0, 100) + 7*c(-1,1)) Stretching by anything less than 7 will generally not succeed. I'm sure this behaviour was not the case until recently. For this example, it's not a big deal, but I often do multiple page plots that require different limits. A more automatic way of making an adjustment would be a great find. TIA 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 -- 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] help on deleting NAs
On Thu, 17-Feb-2005 at 02:54PM -0600, [EMAIL PROTECTED] wrote: | Dear R friends | | My goal is to eliminate this specific group(1) if the # of NAs in this | group greater than | 50%(specifically say greater than 3). Would you please show me how to do | it. | I have a sample data as following: | | Thanks a lot. | | Kevin Lin | |y group f1 f2 f3 | 30 NA 1 1 1 1 | 27 NA 1 1 2 2 | 48 NA 1 2 1 2 | 40 -0.6066416 1 2 2 1 | 24 -0.8323225 1 3 2 2 | 25 1.3401226 2 1 1 1 | 13 1.2619082 2 1 2 1 | 14 -0.4323220 2 3 1 1 | 36 0.8406529 2 3 2 2 | 21 0.9604758 3 1 2 1 | 18 0.9562072 3 2 1 1 | 45 1.1285016 3 2 1 1 | 50 NA 4 1 1 1 | 11 NA 4 1 1 2 | 41 -1.1017167 4 2 1 1 | 37 0.9661283 4 3 1 1 | 39 -0.2540905 4 3 1 2 There's probably a lot of niftier ways but this will give an idea: If X is your dataframe above, aa - with(X, tapply((y), group, function(x) length(x[is.na(x)]))) names(aa[aa2]) [1] 1 X[!with(X, group%in%as.numeric(names(aa[aa2]))),] y group f1 f2 f3 6 1.3401226 2 1 1 1 7 1.2619082 2 1 2 1 8 -0.4323220 2 3 1 1 9 0.8406529 2 3 2 2 10 0.9604758 3 1 2 1 11 0.9562072 3 2 1 1 12 1.1285016 3 2 1 1 13 NA 4 1 1 1 14 NA 4 1 1 2 15 -1.1017167 4 2 1 1 16 0.9661283 4 3 1 1 17 -0.2540905 4 3 1 2 The function in the tapply part could be made more general if 3 doesn't always constitute a majority. HTH -- 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] Examples of multiple key grobs
The xyplot help page gives quite a lot of information how to use key and indicates that legend needs to be used if multiple keys are needed. However, it gives only a brief description of what the grob needs to contain to do multiple keys. I've only used the occasional grid function in panel functions, so I don't have much of a sense of how grobs are constructed. I've been unable to find examples of code used to do multiple keys and would appreciate being pointed in the direction of some. 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
[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] 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
Re: [R] 3d bar plot
On Tue, 18-Jan-2005 at 07:50AM +0100, [EMAIL PROTECTED] wrote: | This graph - | http://www.math.hope.edu/~tanis/dallas/images/disth36.gif | is an example I found at | http://www.math.hope.edu/~tanis/dallas/disth1.html | created by Maple. | | Does anybody know how to create something similar in R? | | I have a feeling it could be possible using scatterplot3d | (perhaps with type=h, the fourth example in help('scatterplot3d')?), | but I cannot figure it out. | | Sorry to butt in with a more fundamental question. Is this really the kind | of graph we want to cultivate and support? In my oppinion, it is hardly ever | necessary to have a graph in 3D or even in higher dimensions (one certain | exception is if one tries to spin a higly dimensional dataset in search of | patterns as you can do in ggobi and there might certainly be others). | | At least the graph presented in the example does - in my eyes - not warrant | a 3D plot. Why not just draw curves for each of the n's in a plot of 'A' | against 'row'? This would enable a reader to make straightforward | comparisons of the curves and allow to estimate the height of the 'columns' | along the 'A'-axis much more easily. I'd agree that 7 curves of different line type and/or colour would make the whole story clearer. More informative labels would help also. What is a row and a column? The rainbow eye candy adds no information and consequently does nothing to improve the information to ink ratio. Of course, that's not important in a world where form takes precedence over substance which I think is what is called the real world. Dejectedly yours, -- 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] Removing trailing spaces
Some years ago when I used S-PLUS, I seem to remember, there was a discussion about a simple method of removing trailing spaces from vector elements. I'd be fairly sure the same would work in R, but I can't find any mention of anything like it in the R archives or with help.search(). There are ways I could do it with substring(), but I seem to remember there was something more elegant. I can find the strip function in the clim.pact package, but that trims everything after the first space which is not useful in this case. Someone please refresh my memory. 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] 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] Removing trailing spaces
On Tue, 21-Dec-2004 at 05:19PM -0600, Marc Schwartz wrote: | On Wed, 2004-12-22 at 11:38 +1300, Patrick Connolly wrote: | Some years ago when I used S-PLUS, I seem to remember, there was a | discussion about a simple method of removing trailing spaces from | vector elements. I'd be fairly sure the same would work in R, but I | can't find any mention of anything like it in the R archives or with | help.search(). | | There are ways I could do it with substring(), but I seem to remember | there was something more elegant. I can find the strip function in | the clim.pact package, but that trims everything after the first space | which is not useful in this case. | | Someone please refresh my memory. | | TIA | | See the final examples in ?sub Yes. Thanks. I knew it was something very simple. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] 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 about a mascot for R?
On Thu, 02-Dec-2004 at 02:08PM -0600, Erin Hodgess wrote: | How about an R-madillo? I'm for R-gnu which already has a song (as pointed out by Murray Jorgensen some time back). I'm sure an arrangement could be worked out with the Emacs people. The Flanders and Swann song, the exact title of which I don't recall, was a response to someone voicing the opinion that the said animal was an Helk. Rather witty in my view and has a spirit in keeping with this list. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] 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] scatterplot of 100000 points and pdf file format
On Wed, 24-Nov-2004 at 10:22AM -0600, Marc Schwartz wrote: | On Wed, 2004-11-24 at 16:34 +0100, Witold Eryk Wolski wrote: | Hi, | | I want to draw a scatter plot with 1M and more points and save it as pdf. | This makes the pdf file large. | So i tried to save the file first as png and than convert it to pdf. | This looks OK if printed but if viewed e.g. with acrobat as document | figure the quality is bad. | | Anyone knows a way to reduce the size but keep the quality? | | Hi Eryk! | | Part of the problem is that in a pdf file, the vector based instructions | will need to be defined for each of your 10 ^ 6 points in order to draw | them. | | When trying to create a simple example: | | pdf() | plot(rnorm(100), rnorm(100)) | dev.off() | | The pdf file is 55 Mb in size. | | One immediate thought was to try a ps file and using the above plot, the | ps file was only 23 Mb in size. So note that ps can be more efficient. | | Going to a bitmap might result in a much smaller file, but as you note, | the quality does degrade as compared to a vector based image. | | I tried the above to a png, then converted to a pdf (using 'convert') | and as expected, the image both viewed and printed was pixelated, | since the pdf instructions are presumably drawing pixels and not vector | based objects. Using bitmap( ... , res = 300), I get a bitmap file of 56 Kb. It's rather slow, most of the time being taken up using gs which is converting the vector image I suspect. Time would be much shorter if, say a circle of diameter of 4 is left unplotted in the middle and others have mentioned other ways of reducing redundant points. A pdf file slightly larger than the png file can be made directly from OpenOffice that has the png imported into it. For a plot of 160mm square, this pdf printed unpixelated. Depending on what size (dimensions) you need to finish up with, you might find you could get away with a lower resolution than 300 dpi, but I usually find 200 too ragged. HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] 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] Intro to R: lecture presentation
On Mon, 25-Oct-2004 at 03:52PM +, Gabor Grothendieck wrote: [...] | The first link worked for me using Windows XP and Internet Explorer | 6. Using Mozilla on the same machine it seemed to download | something but Mozilla was unable to render it (got same as you) so | its likely using IE-specific constructs. Even if I condescend to use IE, I get only a message: 404 Error: File not found Perhaps it moved?! -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] 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] labels on secondary y axis
On Thu, 26-Aug-2004 at 01:34AM +0100, Louize Hill wrote: | Hi, | I have plotted a graph and used a secondary axis as follows: | | plot (d$Year, d$HrFishing, type='l', col='1', xlab='Year', ylab='Effort | (hours/fishing)') | par(new=TRUE) | plot (d$Year, d$Landings, type='l', col='3', xlab='', ylab='') | axis(4) | | However, if I put a label in the 2nd ylab='' it is placed over the 1st ylab, | on the left hand side. | Clearly label in the axis command is not what I want as that erases my tick | marks, and ylab generates errors here! | Please can someone give me a pointer on what I should be using. mtext is your friend. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] 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] Transparent backgrounds in png files
On Thu, 29-Jul-2004 at 08:38AM +0100, Prof Brian Ripley wrote: | The bitmap() device does not support transparency. The png() device does. Unfortunately, though png() does a fine job at a transparent background, it's rather lumpy even on a screen. | | On Thu, 29 Jul 2004, Patrick Connolly wrote: | [...] | Mine is the reverse (and I'm using standard graphics, not Lattice). | I'm trying to get a transparent background but it always comes out | white. Setting bg = transparent, I've tried using a bitmap device | to create a png file. I've also tried creating a postscript file and | converting it to a PNG file using the Gimp. I've always used a | resolution of 300 dpi in bitmaps since the default is far too low. | | Really? You want PNG files of 2000+ pixels in each dimension? Well, 300 dpi is somewhat excessive for onscreen, but not for printing (more below). For a screen at 1600 by 1200 resolution, a bitmap of over 1000 pixels in either direction is not excessive. Using a screen rated at .25mm dot pitch, 75dpi is rather a lot less than sufficient. According to my calculations, .25mm dot pitch corresponds to over 100 dpi, and a .27mm screen is over 90 dpi, so I don't get this 72 business. Perhaps there's something I need to know. Evidently, there's something others know that I don't since png() generated files always turn out lumpy for me. It's worse than the unsatisfactory result of using PowerPoint's turning colours to transparent method I mentioned. People who are used to looking at TV screens might not think it's low resolution, so perhaps I'm too fussy. Maybe I should be more fussy about getting an exact ratio between the number of pixels in the plotting device and the size of the image in PowerPoint. I'm somewhat confused by the fact that PP scales to fit to the slide PNG files that I produce using the Gimp, but not ones made using the png() method directly. What is the essential difference? | -- and you should not really be using bitmapped files for other | uses.) Unfortunate as it may be, many people wish to put graphics in Word files and don't like being unable to see their graphics on their screen even if they have a postscript printer that could print them perfectly. That's where I use 300 dpi PNGs which print at least as well as WMFs I've seen. There was a recent discussion on this list about graphics using OSX which covers most of the same thinking. Nothing in that discussion indicated to me a better way to get graphic files from Linux to Word. If there are any, I'd like to know about them. best -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Transparent backgrounds in png files
The result I'm aiming to achieve is a bitmap that can be imported into a PowerPoint file that shows what's behind the lines of the plot. There's a way in PowerPoint that almost works. By choosing a colour to set as transparent, what is behind the graphic is indeed visible, but it's at the expense of losing line and text definition. I notice there have been discussions about transparent backgrounds mostly with lattice plots. The problem most people seem to have was getting a blue background when they wanted a white one. Mine is the reverse (and I'm using standard graphics, not Lattice). I'm trying to get a transparent background but it always comes out white. Setting bg = transparent, I've tried using a bitmap device to create a png file. I've also tried creating a postscript file and converting it to a PNG file using the Gimp. I've always used a resolution of 300 dpi in bitmaps since the default is far too low. Other ideas appreciated. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor9.1 year 2004 month06 day 21 language R 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to drop rows from a data.frame
On Wed, 30-Jun-2004 at 11:57PM -0400, Peter Wilkinson wrote: | here is a snippet of data where I would like to drop all rows that have | zeros across them, and keep the rest of the rows while maintaining the row | names (1,2,3, ...10). The idea here is that a row of zeros is an indication | that the row must be dropped. There will never be the case where there is a | row(of n columns) with less than 5 zeros in this case(n zeros | | I am unsure how to manipulate the data frame to drop rows whiles keeping | row names. | | Peter | | the data (imagine separated by tabs): | |SEKH0001 SEKH0002 SEKH0003 SEKH0004 SEKH0005 | [1,] 256.1139 256.1139 256.1139 256.1139 256.1139 | [2,] 283.0741 695.1000 614.5117 453.0342 500.1436 | [3,] 257.3578 305.0818 257.3578 257.3578 257.3578 | [4,] 0.0. 0. 0. 0. | [5,] 0.0. 0. 0. 0. | [6,] 0.0. 0. 0. 0. | [7,] 0.0. 0. 0. 0. | [8,] 257. 257. 257. 257. 257. | [9,] 305.7857 2450.0417 335.5428 305.7857 584.2485 | [10,] 0.0. 0. 0. 0. I'm curious to know how you got those row names. I suspect you really have a matrix. If it were a dataframe, it would behave exactly how you are reqesting -- depending on how you got rid of rows 4:7. Try as.data.frame(whatever.your.data.is.now) Then deleting the rows will look like: SEKH0001 SEKH0002 SEKH0003 SEKH0004 SEKH0005 1 256.1139 256.1139 256.1139 256.1139 256.1139 2 283.0741 695.1000 614.5117 453.0342 500.1436 3 257.3578 305.0818 257.3578 257.3578 257.3578 8 257. 257. 257. 257. 257. 9 305.7857 2450.0417 335.5428 305.7857 584.2485 HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sorting elements in a data.frame
On Wed, 23-Jun-2004 at 07:29PM +0100, Dan Bolser wrote: | | Hi, | | I have data like this | | print(x) | | ID VAL1VAL2 | 12 6 | 24 9 | 345 12 | 499 44 | | What I would like is data like this... | | ID VAL1VAL2 | 12 6 | 24 9 | 312 45 | 444 99 | | | So that my analysis of the ratio VAL2/VAL1 is somehow uniform. By uniform, I'm guessing you want them to be = 1 If z is a vector of VAL2/VAL1 values, you can make them all = 1 this way. z[z 1] - z[z 1]^-1 Depending on just how you want to use them, there could be better ways but I've done enough guessing for now. HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] naive question
On Tue, 29-Jun-2004 at 10:31PM -0400, [EMAIL PROTECTED] wrote: | We need more details about your problem to provide any useful | help. Are all the variables numeric? Are they all completely | different? Is it possible to use `colClasses'? | | It is possible, but very inconvenient. There are mostly numeric columns, | but some integer categories, and some string names. The total number is | high, so doing this by hand would take several minutes as well, so a | different solution is preferable. I did use as.is=TRUE, but that did not For the lazy typist, here's an idea: Make a small subset of the datafile (say the first 20 rows) and read that in with read.table. X - read.table(blah.txt, header = TRUE, ) Xclasses - sapply(X, class) Now we have a nice long vector that you can use in your colClasses argument with the whole data. Even if it needs a bit of editing, it will save you typing in all those numeric strings. HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Numbers as symbols
On Mon, 28-Jun-2004 at 09:37PM -0700, Nick Drew wrote: | I want to use question numbers from my survey data | (fake data below) as markers in a scatterplot. I'm | using as.character to convert question numbers to | characters. However, plot truncates the 0 (zero) off | of question 10. How can I get the ending zero so I can | add questions 11 - 20? | | # Sample code below | Question - c(1,2,3,4,5,6,7,8,9,10) | Performance - | c(3.5,3.6,3.7,3.8,3.9,4,4.1,4.2,4.3,4.4) | Importance - | c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.99) | Survey - | data.frame(cbind(Question,Performance,Importance)) | | nums -as.character(Question) | plot(Performance, Importance, xlab='Graph', | ylab='',pch=nums, axes=T) Try this instead: plot(Performance, Importance, xlab='Graph', ylab='',pch= , axes=T, adj = 0) text(Performance, Importance, text=nums) HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Tick marks in xyplot
On Wed, 23-Jun-2004 at 07:32AM -0500, Deepayan Sarkar wrote: [...] | 1. You can specify the limits, tick positions, and axis labels | individually for each panel (see documentation for 'scales' in ?xyplot; | all the relevant components - at, lab, etc - can be lists). How difficult would it be to make mgp one of the 'relevant components'? I often find I'd like to decrease the mgp[2] setting. I think that's the only reason why I'd like to have mgp in the list, so if there's a smarter way of achieving that, mgp would be unnecessary. Is there a smarter way? -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A way to list only variables or functions?
On Mon, 21-Jun-2004 at 03:50PM +0100, Barry Rowlingson wrote: | Duncan Murdoch wrote: | | | I seem to recall that S-PLUS has such a function, but I forget the | name of it. Probably R does too, on CRAN if not in the base | packages. | | objects.summary() I think it was. | | It always bothered me that the Nth thing you teach Unix users is 'ls' | and the N+1th thing is 'ls -l' (for very small N). Then you teach them | R, and there's no 'ls -l' equivalent immediately obvious. | | Not sure what such a function could show, there being no permissions, | or dates on R objects, but object.size() and class/mode at least would | be useful. | | So is something like this in CRAN? I say +1 to putting it in the base | packages I hesitate to mention it again. Last time I did there was minimal interest. However, the question has been asked again, so perhaps now is different I made myself a function in the S-PLUS days which I've modified to work in R. It involved adding another few functions to add dates to objects. This is the sort of output it gives: Object Mode Rows Cols LenDate 1 last.warning list -- --1 NA/NA/NA 2 sim.notuff17C.df dataframe 100 9 9 09/06/2004 3 box.sim function -- --1 04/06/2004 4 box.simC function -- --1 04/06/2004 5 multi.simfunction -- --1 04/06/2004 6 multi.simC function -- --1 04/06/2004 7 sim.100B function -- --1 04/06/2004 8 sim.100C function -- --1 04/06/2004 9 sim.100.df dataframe 100 9 9 04/06/2004 10 sim.notuff17.df dataframe 100 9 9 04/06/2004 11 sim.notuff.dfdataframe 100 9 9 04/06/2004 12 sim.tuff.df dataframe 100 9 9 04/06/2004 13 aa numeric100 9 900 03/06/2004 14 sim.100A function -- --1 03/06/2004 15 sim.100 function -- --1 01/06/2004 16 develop.df dataframe 161 7 7 28/05/2004 17 glm.both function -- --1 24/05/2004 18 lm.gall function -- --1 24/05/2004 19 aphidgall.df dataframe 79 4 4 12/05/2004 20 pears.gall function -- --1 13/11/2003 21 glm.gallEPS function -- --1 27/08/2003 I've toyed with the idea of adding an object size column but it's not important enough for my use. Since I revisit projects over a period of years at times, the date is very useful information -- in fact, it's the main reason why I wrote it. My code is not elegant enough for an esteemed place on CRAN. I could make it a lot better myself if I spent the time on it, but it works well enough for me as it is, so in that sense, it ain't broke. However, if anyone is interested in having such functionality my code could be a good starting point. Best -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Resolution of plots
On Thu, 17-Jun-2004 at 08:00AM -0700, Thomas Lumley wrote: | On Wed, 16 Jun 2004, Prof Brian Ripley wrote: | | You will have to tell us more. Exporting how: to what format using what | device and what exact command on what operating system? | | The only device I know of that even knows about dpi is bitmap() and that | has no such limit unless imposed by your implementation of ghostscript. | | There is an issue with PNG. libpng provides png_set_pHYs to set resolution | (in pixels/metre) but provides a default if it is not set. We don't set | it, and so get the default resolution. I don't follow. Is that in relation to the function bitmap()0 or to png()? -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Quirks with system.time and simulations
I tried the code that Richard O'Keefe posted last week, to wit: library(chron) ymd.to.POSIXlt - function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d))) n - 10 y - sample(1970:2004, n, replace=TRUE) m - sample(1:12, n, replace=TRUE) d - sample(1:28, n, replace=TRUE) system.time(ymd.to.POSIXlt(y, m, d)) [1] 8.78 0.10 31.76 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 14.64 0.13 53.30 0.00 0.00 On a somewhat newer machine, I got $ R --vanilla R : Copyright 2004, The R Foundation for Statistical Computing Version 1.9.0 (2004-04-12), ISBN 3-900051-00-3 [...] library(chron) ymd.to.POSIXlt - + function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d))) n - 10 y - sample(1970:2004, n, replace=TRUE) m - sample(1:12, n, replace=TRUE) d - sample(1:28, n, replace=TRUE) system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.67 0.24 2.01 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 3.06 0.02 3.08 0.00 0.00 But then I tried a few more times... system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.09 0.04 1.13 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.11 0.09 1.20 0.00 0.00 The second time is a lot faster, but subsequent ones don't improve further. ' But with the standard function, system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.64 0.02 2.66 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.82 0.03 2.85 0.00 0.00 ... it does improve slightly but rather a lot less. THEN If I compare the two methods in the reverse order, $ R --vanilla R : Copyright 2004, The R Foundation for Statistical Computing Version 1.9.0 (2004-04-12), ISBN 3-900051-00-3 [] library(chron) ymd.to.POSIXlt - + function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d))) n - 10 y - sample(1970:2004, n, replace=TRUE) m - sample(1:12, n, replace=TRUE) d - sample(1:28, n, replace=TRUE) system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 3.66 0.02 3.76 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.65 0.05 1.70 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.59 0.02 2.61 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.73 0.00 2.74 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.29 0.01 1.30 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 0.94 0.00 0.94 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.06 0.01 1.07 0.00 0.00 It seems as though the first simulation makes it easier for subsequent simulations of the same type AND also for simulations of a somewhat different type also. The degree to which it helps varies according to just what is being run (no surprise there). What I can't figure out is what is happening that makes it quicker for second and subsequent runs. I even tried doing a gc() and setting seeds before each run to make a more direct comparison, but it made no difference other than being slightly less variable. I have seen a similar phenomenon in other types of simulations. In the case of this code, it makes no difference whether n is 100 or 1000. Would that be attibutable to lazy evaluation? version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor9.0 year 2004 month04 day 12 language R It's not exactly a problem, but it could have a bearing on comparing processing times which is something that happens from time to time. In the comparison that gave rise to the code above, the order would have made a substantial difference to the perceived effectiveness of Richard's code. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Quirks with system.time and simulations
On Sun, 13-Jun-2004 at 08:50PM -0400, Roger D. Peng wrote: | I think the first time is potentially much slower because of a | garbage collection. Even if I do gc() before each one, there's no difference, so I kind of doubt that. | R-devel has a flag `gcFirst' for system.time() which (I think) | forces a garbage collection before timing. Would that be any different from explicitly doing gc()? I tried something similar in Splus 3.4. Of course, the same code doesn't work, but a large paste job took exactly the same time (to 4 decimal places) irrespective of how many times the job had been done before. Evidently, things are very different there. Best -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] off topic publication question
On Tue, 08-Jun-2004 at 08:56PM +0100, Phineas Campbell wrote: | I had assumed that the use of we in articles was either due to | formality, like the distinction between tu and vous in French. The | English monarch never refer to themselves in the singular. Hence the use of the term The Royal We when referring to a purportedly group decision that was really made by one individual who is attempting to hide that fact. In the case of an author, the attempt could be to appear more modest. We are not all prima donnas. :-) -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Vectors of years, months, and days to dates?
On Tue, 08-Jun-2004 at 02:57PM +1200, Richard A. O'Keefe wrote: | Rolf Turner [EMAIL PROTECTED] attacked: | Have you ***any*** evidence that R's procedure degrades | performance, under any circumstances? (Apparently not.) In | that case why are you going on and on about it? | | I did the following: | | library(chron) | ymd.to.POSIXlt - | function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d))) | n - 10 | y - sample(1970:2004, n, replace=TRUE) | m - sample(1:12, n, replace=TRUE) | d - sample(1:28, n, replace=TRUE) | system.time(ymd.to.POSIXlt(y, m, d)) | [1] 8.78 0.10 31.76 0.00 0.00 | system.time(as.POSIXlt(paste(y,m,d, sep=-))) | [1] 14.64 0.13 53.30 0.00 0.00 | | This was on a 500MHz SunBlade100, a slow machine by today's standards, | using R 1.9.0. There is all the evidence one could reasonably ask for | that going through paste() instead of providing y, m, d as numeric | vectors *does* degrade performance under at least some circumstances. Ain't that just the darnest thing? I tried on a somewhat faster machine and got this: system.time(ymd.to.POSIXlt(y, m, d)) [1] 2.06 0.22 2.29 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.82 0.04 2.86 0.00 0.00 Negligible difference, I'd have thought, but I tried a few more times system.time(ymd.to.POSIXlt(y, m, d)) [1] 1.12 0.11 1.23 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.69 0.04 2.73 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 0.98 0.02 1.00 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.82 0.00 2.82 0.00 0.00 system.time(ymd.to.POSIXlt(y, m, d)) [1] 0.98 0.04 1.02 0.00 0.00 system.time(as.POSIXlt(paste(y,m,d, sep=-))) [1] 2.65 0.03 2.68 0.00 0.00 ymd.to.POSIXlt benefits from repeated, but the as.POSIXlt method doesn't. I even tried it again with a new R process and got the same sort of thing? What makes the difference? -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] POSIXct vs Dates
On Thu, 22-Apr-2004 at 07:53PM +, Gabor Grothendieck wrote: [] | Time zones are not part of the problem | yet you have to track them. That conflicts with good design | since good design means your programs don't depend on extraneous | elements. | | With chron and Date there are no time zones so this type of problem | will not occur in the first place. I, for one, think it's a great idea. I'm sure it must be common to deal only in whole days in a lot of fields. When calculating the difference between times, one is interested only in a precision of days (with plus or minus 4 or 5 hours considered fair enough), yet the difference between POSIXct times will be given as days if they're both the same side of daylight saving changes and as seconds otherwise. That's no big deal when used interactively, but not trivial otherwise. I devised small functions that coerced everything to UT, but that had to be done nearly every step of the way, otherwise the propensity to convert back to local time kept jumping in. It's kind of like that software (there's plenty of it) that keeps defaulting to 'letter' paper irrespective of how often you've set it to the proper international standard. Shortly after I got my GMT coercing functions working and almost ready to make available to the list, I became aware of the forthcoming Date class in 1.9.0, so I decided that was a better idea. In another place and another era, it might have been termed a Great Leap Forward. Great work. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Size of R user base
On Mon, 19-Apr-2004 at 04:47PM -0500, Dirk Eddelbuettel wrote: | On Mon, Apr 19, 2004 at 10:27:25PM +0100, Prof Brian Ripley wrote: | less is not uncommon. A 12% penetration for the book in question | implies 42,000 R users; a more reasonable 5% penetration implies 100,000 | users. A low 1% penetration implies 500,000 users. | | One S book has sold half your number of S-PLUS users, although some sales | are known to be to R users. | | But then you also need to control for different editions and serial buyers. | I happen to have purchased three different editions of a certain S-Plus / R | book now in its 4th edition. | | My preference goes with the numbering scheme attributed to a tribe on some | island in the Pacific which consists of a 'factor' with four levels: 'one', | 'two', 'three', and 'lots'. Hence, I'd go with 'lots of R users'. So how will you distinguish your 4th edition of a certain S-Plus / R book from what comes next? -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Line numbers in error messages
On Mon, 12-Apr-2004 at 03:20PM -0700, Webb Sprague wrote: | Hi Patrick, | | It's very simple using a browser() line in your function somewhere you | know your code's OK, then run line by line. | | The problem is that sometimes you have code of a few hundred lines, to | which you have added a strange little line that craps out because of | some silly mistake that would be apparent if you knew which line to look | at. However you don't want to start inserting browser statements | inside the code, hoping to get close, you just want to know what line | caused the issue. Many things might be better if they were different, but they aren't. Just count your blessings you're using something as easy to delve into as R code. I don't find it difficult to work out where the problem is. The traceback() stack gives an idea which line of your function had a problem. I put a browser just before that, and check if objects are what I thought they'd be. Sometimes it might involve adding a browser to a called function, and sometimes the problem is a long way back. (I've had lots of experience doing this sort of thing.) Even if one does have to go through line by line, unless you have lots of long calculations, it's very quick to move through scores of lines of code using C-c C-n. It's even possible to run a number of lines in one go to work out which bunch the problem is in, then you can look further within that bunch if it's the one that produces an error (it won't have crashed). I've found it much quicker to find errors in R code than I do in perl code. | | I already use ESS. If it would give line numbers, my life would be perfect! I think you'd then find something else that wasn't. :-) | | Is there something about debugging in S/R that I am missing? I don't | want to have to run a debugger except when there is a real problem, not | just some silliness. In my experience, it silliness 99% of the time. Best -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Index of a Loop Variable?
On Tue, 06-Apr-2004 at 03:55PM -0700, Jim Java wrote: | Hi Everyone:-- | | Is it possible, within a for loop not explicitly using whole-number | indexing, to find out the index value of the loop variable within the Depending on what you do with the index in the loop, it's simple enough to use the names of a list instead of the indexes. For example, you can use the part of the list identified by its name without needing to know what its index is. for(i in names(xx)){ do.something(xx[[i]], ...) etc } But if it's the index you need, the answer would be No. HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] stop() vs. error() ?
On Sat, 27-Mar-2004 at 10:13AM -0500, ivo welch wrote: | | hi andy: mea culpa. it is the exit function in most other languages. | It would be exit(0) invocation in C (C++) and perl, for example. I've not had enough experience in perl to have used exit, but this is my guess at what is wanted: spend.time - function(i) { i - 1 while(i 10){ print(i) if (i == 5) break if (i == 7) stop(Is this an error?) i - i + 1 } } spend.time(7) [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 We don't get as far as 7, so the error message doesn't appear. However, if the break is put after 7, an error has already occurred, as in: spend.time2 - function(i) { i - 1 while(i 10){ print(i) if (i == 9) break if (i == 7) stop(Is this an error?) i - i + 1 } } spend.time2(7) [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 Error in spend.time2(7) : Is this an error? HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems with postscript output
On Wed, 24-Mar-2004 at 12:23PM +0100, Philipp Pagel wrote: | Hi! | | I have a little problem with saving plots to file. I use the command | postscript() followed by the plotting command and a dev.off(). | | When I then look at the resulting image saved to disk, some of the | axis labels are missing (see attached image). Is there a way to fix | this. | | R is trying to be smart about labels getting too close/overlap. Specify the | graph to be a little wider and the labels will appear. Looks as though that one's already taking up a whole page. Might be simpler to reduce the axis.cex a tad (assuming the missing ones are not more than 3 letters). HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Why is rpart() so slow?
On Fri, 19-Mar-2004 at 04:44PM +1300, Richard A. O'Keefe wrote: | I've had rpart running on a problem now for a couple of *days*, | but I'd expect a decision tree builder to run in minutes if not | seconds. Why is rpart slow? Is there anything I can do to make | it quicker? Yes. You could give us an indication of just what you're trying to do, with what, and to what, so we would be in a position to say what improvements could be made. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R-business case
On Tue, 16-Mar-2004 at 04:50PM -0500, Jeff Gentry wrote: |Some web sites have hit counters. It should be possible to get | a counts of the numbers of times different parts of R are downloaded. | Do the CRAN web sites include any such? | | But how would CRAN know what sort of activity its mirrors is | receiving? And what does a 'download' mean in an environment like this - | I could download R 10 times, or 10 people could download it ... or even | one person could download it and then give it to 50 people. The numbers | don't necessarily reflect usage patterns, IMO. Yes. Such meters are almost, but not quite completely useless -- rather like Arthur Dent's attempts at getting a cup of tea from the Nutrimatix drink dispenser. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] adding header info to write.table
On Thu, 26-Feb-2004 at 04:15PM -0500, femke wrote: | Hello, | | Could someone please tell if there is a way to append header info | to the top of an exported dataframe (exported with write.table). I | want to append the following, which are the defininitions for an | asciigrid: | ncols 532 | nrows 999 | xllcorner 510465 | yllcorner 4766375 | cellsize 30 | NODATA_value - ?write then use append = TRUE when using write.table HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to get time differences in consistent units?
I'm still having trouble getting to grips with time classes. I wish to calculate the difference in days between events. Browse[1] insp.j$First [1] 2002-02-19 13:00:00 NZDT Browse[1] spray.j$Date [1] 2001-11-29 13:00:00 NZDT Browse[1] insp.jk - spray.j$Date Time difference of 82 days If I save insp.jk to a vector, I get a nice useful value of 82. However, when the dreaded daylight savings enters the picture, we get this sort of thing: Browse[1] insp.j$First [1] 2003-02-14 13:00:00 NZDT Browse[1] spray.j$Date [1] 2002-12-16 13:00:00 NZDT 2003-01-15 13:00:00 NZDT [3] 2003-02-14 13:00:00 NZDT 2003-02-14 13:00:00 NZDT [5] 2003-03-25 12:00:00 NZST Browse[1] insp.jk - spray.j$Date Time differences of 5184000, 2592000,0,0, -3369600 secs Saving that insp.jk to a vector, I get one in seconds which isn't simply comparable to others. It would be simple enough to put in an as.numeric() so that comparisons are always in seconds, but it would be preferable to have some control over how the difference is reported. Looking through previous discussions on this sort of thing I thought I could save hassle by using tz = GMT for everything which is what I've tried, and hence that's why the times are shown as 1pm and noon depending on whether it's NZST or NSDT. It appears to me that while the dates are known to the software as GMT, they are displayed in local time equivalent but before the differnce between them is calculated, that converson happens again whether we like it or not. Evidently, that's not what happens when as.numeric() is used before calculating the difference since in that case (with my data), the difference is always a whole number of days which is appropriate. Is my experience with date differences standard behaviour or an OS idiosyncrasy? platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor8.1 year 2003 month11 day 21 Redhat 7.3 (with the dreaded gcc-2.96 compiler) best -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Date Time Conversion problems...
On Wed, 04-Feb-2004 at 08:31AM -0600, Shawn Way wrote: | At one time (version 1.7), the code below used to work for converting and | extracting based on the Date Time. In version 1.8.1, something changed I | know, but I cannot for the life of me figure out what... [...] | | The error I get is from line 4, | | data2$Date - strptime(as.character(data2$Date),format=%m/%d/%Y) | Error in $-.data.frame(`*tmp*`, Date, value = | strptime(as.character(data2$Date), : | replacement has 9 rows, data has 230 | | This used to work for replacing the dates with POSIX values... Try: data2$Date - as.POSIXct(strptime(as.character(data2$Date),format=%m/%d/%Y)) You'll find that it prints the date labels more usefully in 1.8.1 HTH -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Some more help needed...
On Mon, 19-Jan-2004 at 06:36PM +0100, Peter Dalgaard wrote: | [EMAIL PROTECTED] [EMAIL PROTECTED] writes: | | As an absolute beginner, still reading Modern Applied Statistics | with S and exercising with its examples, I'm frequently stopped | by what it looks to be R poor help system (or is it my gigantic | ignorance?). I mean that using help many arguments of a command | seems to be given for granted like for instance: | ... | ?lines | lines(x, ...) | | ## Default S3 method: | lines(x, y = NULL, type = l, col = par(col), | lty = par(lty), ...) | | Arguments: | | x, y: coordinate vectors of points to join. | | type: character indicating the type of plotting; actually any of |the 'type's as in 'plot'. | | col: color to use. This can be vector of length greater than one, |but only the first value will be used. | | lty: line type to use. | | ...: Further graphical parameters (see 'par') may also be supplied |as arguments, particularly, line type, 'lty' and line width, |'lwd'. | | | How could I quickly know during an R-session what values should be col set to have red, how could I set lty etc.? | | Well, you might take a hint and look at ?par, in which this is in fact | explained. The above text is not saying that very explicitly, I agree. ... that hint being given a little further down the help for lines, where it says: See Also: 'points', 'plot', and the underlying primitive 'plot.xy'. 'par' for how to specify colors. I can't think of a way that makes it easier to get to than that. | | However, it could be a good idea if we found a nice way of | integrating this sort of tabular material in the help system. The | case that really annoys me is that to get at the vaæues for 'pch', | you need to run example(points), which is both nonobvious and | disruptive if you are in the middle of constructing a complex plot | command. Even in that case, it's not a big deal to run a separate R session in another workspace (or even better, viewport in the pre-Gnome2 days) where such ancillary tasks can run. There are OS limitations, of course. -- 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Binomial glms with very small numbers
VR describes binomial GLMs with mortality out of 20 budworms. Is it appropriate to use the same approach with mortality out of numbers as low as 3? I feel reticent to do so with data that is not very continuous. There are one continuous and one categorical independent variables. Would it be more appropriate to treat the response as an ordered factor with four levels? If so, what family would one use? 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Binomial glms with very small numbers
On Wed, 14-Jan-2004 at 05:15PM -0800, Spencer Graves wrote: | The advisability of using glm with mortality depends not on | the size of sample groups but on the assumption of independence: | Whether you have 3 individuals per group or 30 or 1, is it I think we can assume independence. What concerned me more was the fact that there will be rather a lot of 0s and 1s, corresponding to -Inf and Inf on the transformed scale. Only half the possible values (namely, 1 2) will be usable in the fitting. On second thoughts, since the response can be given as a binary, perhaps I was unnecessarily concerned. | plausible to assume that all individuals represented in your | data.frame have independent chances of survival give the | potentially explanatory variables? If the answer is yes, then | glm is appropriate. If the answer is no, then some other tool | may be preferable. However, glm is quick and easy in R, and I | might start with that, even if I felt the assumption of | independence was violated. If I found nothing there, I would not | likely find anything with techniques that handled more | appropriately the violations of independence. Thanks for that suggestion. | | Similarly, I can't see how it would matter whether potentially | explanatory variables were continuous or categorical, as long as a | categorical variable were appropriately coded as a factor (or | character, which is then treated as a factor) if it has more than 2 | levels. I didn't think it would make a difference but I included it in case someone more knowledgeable had reasons why it did. 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 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html