[R] Where are the ticks on grid.xaxis?

2011-08-18 Thread David A. Johnston
Hi R list, I like the default ticks that are set up using grid.xaxis() or grid.yaxis() with no arguments. Finding good values for the 'at' argument is usually not a trivial task; the default behavior of these functions seems to work well. The problem with this strategy is that I cannot figure ou

Re: [R] Pulling data from remote MySQL database

2011-06-21 Thread David A. Johnston
Hi Joseph, I know that the RMySQL and RODBC packages allow you to pull the result of a MySQL query into a data.frame within R. I like RODBC because you can access many different flavors of RDBMS's. -David Johnston -- View this message in context: http://r.789695.n4.nabble.com/Pulling-data-f

Re: [R] Sorting Dataframes

2011-06-07 Thread David A. Johnston
Here's one way: # Here I read in your data to a variable 'x' x = read.delim(textConnection( "Bin Depth Fish 1 4 2 1 8 24 1 12 4 2 4 3 2 8 21 2 12 2 3 4 12 3 8 2 3 12 33"), sep = " ", header = TRUE) do.call(rbind, lapply(split(x, x$Bin), function(grp) grp[which.max(grp$Fish),])) -- View this mes

Re: [R] Interactive plots or graphics libraries for R?

2011-05-24 Thread David A. Johnston
I recommend the 'rgl' package. It can draw 3d scatterplots, shapes, and surfaces. You can spin, and zoom in with the mouse. You can record a "movie" of the rotating graphic. http://cran.r-project.org/web/packages/rgl/index.html -David Johnston -- View this message in context: http://r.7896

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread David A. Johnston
The function all.equal also might be helpful. See the help page. >help(all.equal) -David Johnston -- View this message in context: http://r.789695.n4.nabble.com/identical-values-not-so-identical-newbie-help-please-tp3346078p3346581.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] sapply puzzlement

2011-01-27 Thread David A. Johnston
sapply(z, function(row) ...) does not actually grab a row at a time out of 'z'. It grabs a column (because 'z' is a data.frame) You may want: t(apply(z, 1, function(row) row - means)) or: t(t(z) - means) Hope that helps, -David Johnston -- View this message in context: http://r.789695.n4.n

Re: [R] Parsing a Simple Chemical Formula

2010-12-26 Thread David A. Johnston
There might be something simpler, but this is what I came up with: form = "C5H11BrO" ups = c(gregexpr("[[:upper:]]", form)[[1]], nchar(form) + 1) seperated = sapply(1:(length(ups)-1), function(x) substr(form, ups[x], ups[x+1] - 1)) elements = gsub("[[:digit:]]", "", seperated) nums = gsub("[[:al

Re: [R] Help with RGL package problem

2010-12-15 Thread David A. Johnston
Thank you Joshua and Duncan for your very quick responses. Joshua, I will indeed read more about the OpenGL and GLU systems. Duncan, I am running R via a console. I also tried via the GUI R.app and the same problems with loading the package and opening a graphics device occurred. I find it

[R] Help with RGL package problem

2010-12-15 Thread David A. Johnston
Hello, I have been experiencing an odd error with the RGL package that I cannot figure out. I have searched without luck for fixes to this problem on Rseek, Google, and the R-help-list. RGL used to work on my machine about a month ago. It was a very useful tool. The graphics device will not i