[R] How to repeat code snippet for several variables in a data frame?

2005-08-15 Thread Sander Oom
Dear all, I have a data frame containing the results of an experiment. Like this: a-seq(1,4,by=1) b-seq(1,2,by=1) test-expand.grid(b,a,a) colnames(test)-c(replicates,bins, groups) test$abc - rnorm(32) test$def - rnorm(32) test$ghi - rnorm(32) test The following code snippet aggregates the data

Re: [R] How to repeat code snippet for several variables in a data frame?

2005-08-16 Thread Sander Oom
Thanks for the very useful tips! Now I have enough round and square bracket and other tricks to wrap up the function! The double square bracket trick in test[[varname]] is golden! Thanks again, Sander. __ R-help@stat.math.ethz.ch mailing list

[R] Data frame referencing?

2006-08-04 Thread Sander Oom
Dear R users, When you do: x - rnorm(10) y - rnorm(10) z - rnorm(10) a - data.frame(x,y,z) a$x [1] 1.37821893 0.21152756 -0.55453182 -2.10426048 -0.08967880 0.03712110 [7] -0.80592149 0.07413450 0.15557671 1.22165341 Why does this not work: a[a$y0.5,y] -1 Error in

Re: [R] Data frame referencing?

2006-08-04 Thread Sander Oom
://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Sander Oom [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, August 04, 2006 1:48 PM Subject: [R] Data frame referencing? Dear R users, When you do: x - rnorm(10) y - rnorm(10) z - rnorm(10

[R] IFELSE across a 3D array?

2004-11-22 Thread Sander Oom
Dear all, We are trying to clean multiple realizations of a pattern. Erroneous NODATA and spurious DATA occur in the realizations. As we have to do a 1000 realizations for many patterns, efficiency of the code is important. We need to correct the realizations with a 'mask' pattern of

[R] IFELSE across large array?

2004-11-23 Thread Sander Oom
Dear all, As our previous email did not get any response, we try again with a reformulated question! We are trying to do something which needs an efficient loop over a huge array, possibly functions such as apply and related (tapply, lapply...?), but can't really understand syntax and examples

RE: [R] IFELSE across large array?

2004-12-05 Thread Sander Oom
(the third dimension). Ray Brownrigg From: Sander Oom Dear all, As our previous email did not get any response, we try again with a reformulated question! We are trying to do something which needs an efficient loop over a huge array, possibly functions such as apply and related (tapply

Re: [R] Time line plot in R?

2005-01-18 Thread Sander Oom
, mingw32 status major2 minor0.1 year 2004 month11 day 15 language R Jim Lemon wrote: Sander Oom wrote: Dear R users, In order to illustrate the possible effects of events on variables plotted against time, I would like plot a time line of events along side the plot

Re: [R] embedding fonts in eps files

2005-01-18 Thread Sander Oom
Rudi, If it turns out that fonts can not be embedded with R, then one option is to import/export the file through CorelDraw (or other vector drawing software equivalent). The 'export to eps' function in CorelDraw provides an option to embed all the fonts! It requires manual labour, but it will

Re: [R] Time line plot in R? -- one more problem

2005-01-18 Thread Sander Oom
!? Any suggesting how to resize the graph to plot the time line correctly in postscript? Thanks, Sander. Jim Lemon wrote: Sander Oom wrote: Dear R users, In order to illustrate the possible effects of events on variables plotted against time, I would like plot a time line of events along side the plot

[R] Repeating grey scale in graph?

2005-02-16 Thread Sander Oom
Dear R users, Could somebody tell me why the grey color ramp is repeated in this graph, eventhough the ramp values go from 0 to 1? I must be missing something obvious, but I can not see it! z - c(0.064329041,0.117243316,0.161565116,0.19923015,0.231642175,0.259835539,0.284571226,

Re: [R] Repeating grey scale in graph?

2005-02-16 Thread Sander Oom
the ramp even though it has a surplus of colours (grey levels)! Why not just ignore the surplus colours? Anyway it works, Sander. Peter Dalgaard wrote: Sander Oom [EMAIL PROTECTED] writes: Dear R users, Could somebody tell me why the grey color ramp is repeated in this graph, eventhough

Re: [R] Repeating grey scale in graph?

2005-02-16 Thread Sander Oom
of the original data that it is a good idea to plot his graphs in R instead of excel. ;-) Duncan Murdoch wrote: On Wed, 16 Feb 2005 15:44:00 +0200, Sander Oom [EMAIL PROTECTED] wrote : Thanks Peter! Of course I only have (nx-1)(ny-1) facets in a x*y plot! The help page line: ... col the color(s

Re: [R] Hosting a R Graph Gallery?

2005-02-21 Thread Sander Oom
. Romain. Le 18.02.2005 14:33, Sander Oom a écrit : Dear R users, Following some of the recent questions and discussions about the R plotting abilities, it occurred to me again that it would be very valuable to have an R graph gallery. Eric Lecoutre made a very nice example in: http://www.stat.ucl.ac.be

Re: [R] zeichnung eines wahrscheinlichkeitsnetztes

2005-02-24 Thread Sander Oom
Hi Ernst, Pretty soon some one is going to: 1) tell you that the mailing list is in English, 2) that you should provide more details of your data and 2) that your message should show signs that you have read the posting guide and have searched the help documentation in a first attempt to find

Re: [R] from long/lat to UTM

2005-03-09 Thread Sander Oom
Hi Yyan, The proj4R package by Roger Bivand will allow you to project data in many ways and directions. http://spatial.nhh.no/R/Devel/proj4R-pkg.pdf It uses the proj libraries from: http://www.remotesensing.org/proj/ Not sure where you would derive the time zone! Good luck, Sander. yyan liu

[R] Landscape indeces analysis methods as an R package!?

2005-03-17 Thread Sander Oom
(as a matrix I suppose but what file formats are supported)? I've seen the pixmap library but the formats are not broadly supported. -Original Message- From: Sander Oom [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 16, 2005 3:49 AM To: [EMAIL PROTECTED] Subject: Apack information? Dear Apack

[R] Conditional operation on columns in data frame

2006-03-11 Thread Sander Oom
Dear R-users, I need to do an SQL like, conditional, operation on a data frame using an ifelse construction. However I can not get it to work. Example: x1 - rnorm(10) x2 - rnorm(10) x3 - rnorm(10) x3 - NA y - cbind(x1,x2,x3) y x1 x2 x3 [1,] -0.56927780 -0.30952274

Re: [R] Conditional operation on columns in data frame

2006-03-11 Thread Sander Oom
- ifelse(y$x1 0, y$x2, y$x3) From: [EMAIL PROTECTED] on behalf of Sander Oom Sent: Sat 11/03/2006 11:23 PM To: r-help@stat.math.ethz.ch Subject: [R] Conditional operation on columns in data frame Dear R-users, I need to do an SQL like

RE: Re: [R] Plotting Time against Date for time series data?

2004-05-17 Thread Sander Oom
The plot is nearly there! Using the axis.POSIXct command I have got the x-axis under control. However, the units for the y-axis (Time) are in seconds by default (i.e. range is from 0 to 1440). I'm trying to plot hours along the y-axis, without changing the units for the plot itself, but

[R] Plotting Time against Date for time series data? (2)

2004-05-17 Thread Sander Oom
At 18:39 2004/05/17, you wrote: On Mon, 17 May 2004, Sander Oom wrote: The plot is nearly there! Using the axis.POSIXct command I have got the x-axis under control. However, the units for the y-axis (Time) are in seconds by default (i.e. range is from 0 to 1440). I'm trying to plot hours along

[R] Calculating distances between points in a data frame?

2004-05-31 Thread Sander Oom
11 for (i in rngNum){ + XY$DistXY2[i] - ifelse(i=min(rngNum), NA, sqrt(((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2)) ) + } Error in ifelse(i = min(rngNum), NA, sqrt(((X[i] - X[i - 1])^2) + ((Y[i] - : unused argument(s) (i ...) detach(XY) Any suggestions much appreciated, Sander Oom

Re: [R] Calculating distances between points in a data frame?

2004-05-31 Thread Sander Oom
(gregmisc) XY - data.frame(num = seq(0,10), X = seq(0,30,3), Y = seq(0, 40, 4) ) DistXY - function(idx) { i - idx[2] with(XY, sqrt( (X[i]-X[i-1])^2 + (Y[i]-Y[i-1])^2 ) ) } XY$Dist - running( 1:nrow(XY), width=2, fun = DistXY, pad = TRUE ) Sander Oom slist at oomvanlieshout.net writes: : : Dear

[R] Help needed with lattice graph!

2005-04-22 Thread Sander Oom
Dear R users, If I manage to sort out this graph, it is certainly a candidate for the new R graph gallery (http://addictedtor.free.fr/graphiques/displayGallery.php)! I created the following lattice graph: library(lattice) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species =

[R] Plotting means and confidence intervals by group factor using lattice graphics?

2005-05-04 Thread Sander Oom
Dear R graphics gurus, Another question about lattice graphics. This time I would like to plot means and confidence intervals by group factor in a lattice graph. I can not find any working lattice examples. Maybe a custom panel function is the answer, but that is a bit beyond me for now. The

Re: [R] Plotting means and confidence intervals by group factor using lattice graphics?

2005-05-06 Thread Sander Oom
) ~ month|continent, groups=sex, data=dfr); Key() # add ,label.curves=FALSE to suppress use of labcurve to label curves where # farthest apart Deepayan Sarkar wrote: On Wednesday 04 May 2005 10:30, Sander Oom wrote: Dear R graphics gurus, Another question about lattice graphics. This time I would like

[R] Problem with data frame when using xYplot?

2005-05-12 Thread Sander Oom
Dear all, I am trying to plot means and error bars using xYplot, but I get an error message from xYplot which I can not figure out: Error in Summary.factor(..., na.rm = na.rm) : range not meaningful for factors The data frame (tmpNa) was created using aggregate. I have used dump to

Re: [R] Problem with data frame when using xYplot?

2005-05-13 Thread Sander Oom
), xlab=Position, ylab=Sodium ) Sander Oom wrote: Dear all, I am trying to plot means and error bars using xYplot, but I get an error message from xYplot which I can not figure out: Error in Summary.factor(..., na.rm = na.rm) : range not meaningful for factors The data frame (tmpNa

[R] Conflict between xtable and Hmisc when using Sweave?

2005-05-13 Thread Sander Oom
. *** \documentclass[a4paper]{article} \title{Sweave Test for summarize} \author{Sander Oom} \usepackage{a4wide} \begin{document} \maketitle \begin{figure}[ht] \begin{center} fig=TRUE,echo=FALSE= # library(xtable) library(Hmisc) set.seed(111) dfr - expand.grid(month=1:12, year=c

Re: [R] Problem with data frame when using xYplot?

2005-05-13 Thread Sander Oom
, ...) }, par.settings = sp, auto.key=list(columns=1, x=0.7, y=0.8, corner = c(0,0)) ) Sander Oom wrote: An off list response from Mat Soukop (thanks Mat!!) provides an even more elegant solution (see code below)! I have included the original code, so people

Re: [R] Problem with data frame when using xYplot?

2005-05-13 Thread Sander Oom
Hi Deepayan! Deepayan Sarkar wrote: On Friday 13 May 2005 08:07 am, Sander Oom wrote: An off list response from Mat Soukop (thanks Mat!!) provides an even more elegant solution (see code below)! I have included the original code, so people can decide whether to plot in a single panel

Re: [R] Problem with data frame when using xYplot?

2005-05-13 Thread Sander Oom
: On Friday 13 May 2005 10:36 am, Sander Oom wrote: Hi Deepayan! Deepayan Sarkar wrote: On Friday 13 May 2005 08:07 am, Sander Oom wrote: An off list response from Mat Soukop (thanks Mat!!) provides an even more elegant solution (see code below)! I have included the original code, so people can decide

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-13 Thread Sander Oom
wrote: Sander Oom wrote: Dear R users, The Sweave code below runs fine, as it is. However, an error occurs when the line 'library(xtable)' is uncommented: Error: chunk 1 Error in label-(`*tmp*`, value = month) : no applicable method for label- Is anybody aware of this and knows

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
) to export the anova table, but results are not promising! I prefer xtable!! Thanks, Sander. Frank E Harrell Jr wrote: Sander Oom wrote: Dear Frank, I have a Sweave document in which I export anova (aov) tables to Latex and calculate some summary statistics with summarize{Hmisc} for a graph

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
specifically. Andy From: Of Sander Oom Dear David, I would like to use summarize(Hmisc) and print.xtable(xtable) in a single Sweave document, but a conflict with the 'label' function prohibits this at the moment! Would you be able to correct the conflicting code? I will gladly test the new package! I

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
suggested to access label() in xtable. (I would use some other name, though: label() in xtable is already an S3 generic). Andy From: Sander Oom Hi Andy and Gabor, Thanks for your help so far! I am discovering another R dimension. Trying to put my head around all thisthe conflict actually

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
of that, you should make sure that Hmisc is loaded later than xtable, and use something like what Gabor suggested to access label() in xtable. (I would use some other name, though: label() in xtable is already an S3 generic). Andy From: Sander Oom Hi Andy and Gabor, Thanks for your help so far

Re: [R] adjusted p-values with TukeyHSD?

2005-05-17 Thread Sander Oom
Hi Chris and Chris, I was keeping my eye on this thread as I have also been discovering multiple comparisons recently. Your instructions are very clear! Thanks. Now I would love to see an R boffin write a nifty function to produce a graphical representation of the multiple comparison, like this

Re: [R] adjusted p-values with TukeyHSD?

2005-05-17 Thread Sander Oom
is different from mean three but not mean one. You then get: a, ab, c for mean one, two and three respectively. Of course what is often used does not constitute the best way of doing it. Sander. Liaw, Andy wrote: From: Sander Oom Hi Chris and Chris, I was keeping my eye on this thread as I have also

[R] How to get special (Hershey) font symbols into plot axis labels? [Revisited]

2005-05-24 Thread Sander Oom
Dear R users, I would like to use sub- and super-script in axis labels. I assume this is best done using Hershey symbols. When trying to find information on using Hershey font symbols in axis labels, I came across the following discussion thread:

Re: [R] Plot range resizing when adding additiona lines

2005-05-24 Thread Sander Oom
Hikel, Jerry wrote: Hi -- I have searched the documentation and archives on graphing capabilities in R for the past couple of hours, but I haven't been able to find anything directly related to my problem. I want to create a plot with several lines displayed on it. I want each line to be

[R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
Dear R users, has anybody made an attempt to create the soil texture triangle graph in R? For an example see here: http://www.teachingkate.org/images/soiltria.gif I would like to get the lines in black and texture labels in gray to allow for plotting my texture results on top. Any

Re: [R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
] tmp library(vcd) ## Mark groups ternaryplot(tmp, grid=FALSE, dimnames.position = none, pch=1, col=black, scale=1, main=NULL, prop.size=FALSE, ) soil.triangle() Sander Oom wrote: Hi Jim, This looks impressive! It gives me the 'background' graph. However, I'm not sure how I can use

Re: [R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
- rep(black,10) pch - rep(1, 10) plot.soiltexture(tmp,pch,col=black) Sander Oom wrote: Right, Got the data points plotted on top of the soil texture background, thanks to Jim and ternaryplot{vcd}! See code below. Now there is some fine tuning to do, as it should really look like this graph

Re: [R] Soil texture triangle in R?

2005-05-28 Thread Sander Oom
with the generic plot functions works well. Makes the function less dependent on other packages! Will merge the two functions into one and post it back to the mailing list! Then the graph might be ready for the graph gallery! Thanks, Sander. Jim Lemon wrote: Sander Oom wrote: Hi Jim

Re: [R] Soil texture triangle in R?

2005-05-28 Thread Sander Oom
(pi/3)) # # Author(s) # # Jim Lemon # Sander Oom # # References # # Soil Survey Division Staff. 1993. Soil survey manual. Soil Conservation Service. # U.S. Department of Agriculture Handbook 18. # # Examples # # # some triangular data # library(MASS) # tmp-(Skye/100) # # colnames choosen

Re: [R] R GUI for Linux?

2005-05-29 Thread Sander Oom
HI Robert, Of course Linux already has a console! Just type R in the Terminal console and R will start (assuming all is installed correctly). Graphics will be launched in separate windows. If you want more then the Terminal console, try: http://www.sciviews.org/_rgui/ Good luck, Sander.

Re: [R] R GUI for Linux?

2005-05-30 Thread Sander Oom
Hi Charles, Warm felt sympathies for your struggles. I consider myself a happy GUI user and have also struggled with the 'command line' history and lack of out-of-the-box functionality associated with Linux. However, Linux does have many, many advantages over other OS's, so I will stick to

Re: [R] Increasing Console Paste Buffer

2005-06-01 Thread Sander Oom
An interesting thought just came to me when reading this discussion! I use both R and Latex and have never had the trouble of overlooking error messages when debugging long Latex code! Of course this is because when compiling a latex document, a summary of the compilation process is provided

Re: [R] Increasing Console Paste Buffer

2005-06-01 Thread Sander Oom
Indeed it does! Sorry for the impulsive response! Sander. Duncan Murdoch wrote: Sander Oom wrote: An interesting thought just came to me when reading this discussion! I use both R and Latex and have never had the trouble of overlooking error messages when debugging long Latex code

[R] How to 'de-cross' a table?

2005-06-03 Thread Sander Oom
Dear R users, I have received a table in the following format: id a b c1 c2 d1 d2 1 1 1 65 97 78 98 2 1 2 65 97 42 97 3 2 1 65 68 97 98 4 2 2 65 97 97 98 Factors of the design are: a, b, and e, where e has levels c and d. The levels c and d then have 2

Re: [R] How to 'de-cross' a table?

2005-06-04 Thread Sander Oom
Hi Thomas, Your code works perfectly! Thanks a lot, Sander. Thomas Lumley wrote: On Fri, 3 Jun 2005, Sander Oom wrote: Dear R users, I have received a table in the following format: id a b c1 c2 d1 d2 1 1 1 65 97 78 98 2 1 2 65 97 42 97 3 2 1 65 68 97 98

Re: [R] A long digression on packages

2005-06-06 Thread Sander Oom
Maybe some of this confusion about search opportunities and pros/cons could be avoided if the search page on CRAN (http://cran.r-project.org/search.html) would be extended to cover all main search tools! Quickly scanning the discussion, I found these: 1- simply Google: some tips and tricks

Re: [R] Polar Graph

2005-06-06 Thread Sander Oom
Navarre Sabine wrote: Hi, I would like to do a polar graph (=star graph) ! is that graph existing on R? Because more softwares can do that but I don't found it on R! Thanks Sabine - ils, photos et vids ! [[alternative

Re: [R] R Graph Gallery : categorization of the graphs

2005-06-06 Thread Sander Oom
Barry Rowlingson wrote: Romain Francois wrote: Graphics will be classified in : - categories - sub-categories within those categories So far so good. Maybe, maybe not! Would a system of keywords work better than strict hierarchical categories, as long as plots can have more than one

Re: [R] R Graph Gallery : categorization of the graphs

2005-06-07 Thread Sander Oom
. Chris Evans wrote: On 6 Jun 2005 at 17:48, Sander Oom wrote: ... much snipped ... The whole point of a gallery is to show something to the user before the user knows what he is looking for. The R help functions currently available are hopeless when you have a picture of a graph in your head

Re: [R] A long digression on packages

2005-06-07 Thread Sander Oom
Oooops, already missed one: 5. search of the R mailing lists: http://maths.newcastle.edu.au/~rking/R/ ad5. never used this before. Think Google also does an excellent job finding these if you start search with R. Sander. Sander Oom wrote: Maybe some of this confusion about search

Re: [R] Tabelle zu Matrix

2005-06-07 Thread Sander Oom
Why ask if you already know the answer. Did you try table()? Other commands related: reshape {stats} and xtabs {stats} I learned about this only a couple of days ago on this list! Meanwhile read the posting guide and send your requests in English. Good luck, Sander. Hansi Weissensteiner

Re: [R] R Graph Gallery : categorization of the graphs

2005-06-07 Thread Sander Oom
. Romain Francois wrote: Le 07.06.2005 12:36, Sander Oom a écrit : I agree that a wiki to facilitate submission of graph code could be very effective! Still needs to be well protected against vandalism. Seems a regular backup, to facilitate a clean restore, is the best approach. Romain, would you

Re: [R] plot3d

2005-06-09 Thread Sander Oom
Sabine, It helps us to help you if you tell us what you want to do, preferably with a code example, and what system/version of R you have: type version. On my PC I get: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2

Re: [R] plot3d

2005-06-09 Thread Sander Oom
Now you made me curious! Installed the package myself as well! Maybe you can send an example graph to Romain, to be included in the graph gallery. Then we can all see what plot3d does! Thanks, Sander. Sander Oom wrote: Sabine, It helps us to help you if you tell us what you want to do

[R] Replacing for loop with tapply!?

2005-06-10 Thread Sander Oom
Dear all, We have a large data set with temperature data for weather stations across the globe (15000 stations). For each station, we need to calculate the number of days a certain temperature is exceeded. So far we used the following S code, where mat88 is a matrix containing rows of 365

Re: [R] Replacing for loop with tapply!?

2005-06-10 Thread Sander Oom
: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Sander Oom [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, June 10, 2005 10:50 AM Subject: [R

Re: [R] Replacing for loop with tapply!?

2005-06-10 Thread Sander Oom
Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Sander Oom [EMAIL PROTECTED] To: Dimitris Rizopoulos [EMAIL

Re: [R] Replacing for loop with tapply!?

2005-06-12 Thread Sander Oom
, Sander Oom wrote: Dear all, Dimitris and Andy, thanks for your great help. I have progressed to the following code which runs very fast and effective: mat - matrix(sample(-15:50, 15 * 10, TRUE), 15, 10) mat[mat45] - NA mat-NA mat temps - c(35, 37, 39) ind - rbind( t(sapply(temps, function(temp

Re: [R] some suggestion

2005-06-14 Thread Sander Oom
Shame nobody has included this function in their package! Would be useful to have as a standard function! Sander. Dimitris Rizopoulos wrote: take a look at this function by Kevin Wright RSiteSearch(sort.data.frame) Best, Dimitris Dimitris Rizopoulos Ph.D. Student

Re: [R] soil.texture() function with bug?

2006-11-24 Thread Sander Oom
. Patrick Kuss wrote: Dear Sander Oom and Jim Lemon, thanks for putting the soils.texture() function into R. However, for whatever reason I am not able to display the triangle correctly. Each of the 27 tick labels shows as c(10,20,30,40,50,60,70,80,90) and thus basically cover the whole triangle