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 &g

Re: [R] Data frame referencing?

2006-08-04 Thread Sander Oom
jnenvoer 35, Leuven, Belgium > Tel: +32/(0)16/336899 > Fax: +32/(0)16/337015 > Web: http://med.kuleuven.be/biostat/ > http://www.student.kuleuven.be/~m0390867/dimitris.htm > > > - Original Message - > From: "Sander Oom" <[EMAIL PROTECTED]> > To: > Se

[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$y>0.5,y] <-1 Error in "[<-.d

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

2006-03-11 Thread Sander Oom
objects, but columns of y. So you need to specify > that. > > y$x4 <- 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.

[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

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 https:/

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

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] Replacing for loop with tapply!?

2005-06-12 Thread Sander Oom
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] > daily_max 44 42 39 41 45 43 42 45 NA42 > above_37 21 213221 NA 1 > above_39 21013211 NA 1 > above_41 21002211

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

2005-06-10 Thread Sander Oom
; Ph.D. Student > Biostatistical Centre > School of Public Health > Catholic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, Belgium > Tel: +32/16/336899 > Fax: +32/16/337015 > Web: http://www.med.kuleuven.ac.be/biostat/ > http://www.student.kule

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

2005-06-10 Thread Sander Oom
Best, > Dimitris > > > Dimitris Rizopoulos > Ph.D. Student > Biostatistical Centre > School of Public Health > Catholic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, Belgium > Tel: +32/16/336899 > Fax: +32/16/337015 > Web: http://ww

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

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

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 m

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

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 ab

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

2005-06-07 Thread Sander Oom
!! Sander. 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

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 key

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 vid廩s ! > > [[

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 hav

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

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

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! Of

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 a

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 it.

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. R

Re: [R] Soil texture triangle in R?

2005-05-28 Thread Sander Oom
nd + Silt + Clay = 1, # are: P(1-Sand+(Sand-(1-Silt))*0.5, Clay*sin(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 tria

Re: [R] Soil texture triangle in R?

2005-05-28 Thread Sander Oom
9,0.06*sin60,"Silt", col=coltext) par(oldpar) } tmp <- array(dim=c(10,3)) tmp[,2] <- abs(rnorm(10)*20) tmp[,3] <- abs(rnorm(10)*10) tmp[,1] <- 100-tmp[,2]-tmp[,3] col <- rep("black",10) pch <- rep(1, 10) plot.soiltexture(tmp,pch,col=NULL,colgrid="black&qu

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: >&g

Re: [R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
ot;, col="grey") text(0.06,0.021,"Sand", col="grey") x1<-c(0.37,0.435,0.5,0.8,0.86) x2<-c(0.435,0.537,0.64,0.86,0.94) y1<-c(0.2*sin60,0.08*sin60,0,0,0.12*sin60) y2<-c(0.08*sin60,0.08*sin60,0.285*sin60,0.12*sin60,0.12*sin60) segments(x1,y1,x2,y2,

Re: [R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
n60) segments(x1,y1,x2,y2, col="grey") text(0.49,0.18*sin60,"Loam", col="grey") text(0.72,0.15*sin60,"Silt loam", col="grey") text(0.9,0.06*sin60,"Silt", col="grey") par(oldpar) } tmp <- array(dim=c(10,3)) tmp[,1] &l

Re: [R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
Hi Jari, I assume this has been superseded by the ternaryplot{vcd} function!? Thanks, Sander. Jari Oksanen wrote: > Sander, > > Just a quick note before I go to the field. > > I attach a tri.R file for drawing ternary plots. The base function was > posted to R News someday. One thing that I ad

Re: [R] Soil texture triangle in R?

2005-05-27 Thread Sander Oom
Maybe I should try to figure out how to replicate your code inside a ternaryplot{vcd} call. Cheers, Sander. Jim Lemon wrote: > Sander Oom wrote: >> Dear R users, >> >> has anybody made an attempt to create the soil texture triangle graph >> in R? For an example see here

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

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 display

[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: http://maths.newcastle.edu.au/~rking/R/help/0

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

2005-05-17 Thread Sander Oom
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

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] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
e that involves Hmisc but not xtable... detach("package:Hmisc") library(xtable) ...code that involves xtable but not Hmisc... On 5/16/05, Sander Oom <[EMAIL PROTECTED]> wrote: I tried to follow your suggestions, but without success: Error: couldn't find function "xtable.my

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

2005-05-16 Thread Sander Oom
ge source code. Short 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, Th

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

2005-05-16 Thread Sander Oom
to do that, as that constitute a change in the package source code. Short 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 gener

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

2005-05-16 Thread Sander Oom
renaming the functions is to add namespace to either xtable or Hmisc. Given the size of Hmisc, it probably would be much easier to do that with xtable. With namespace in xtable, you can do xtable:::label() to refer to the label() in xtable specifically. Andy From: Of Sander Oom Dear David, I would li

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

2005-05-16 Thread Sander Oom
(Hmisc) 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-13 Thread Sander Oom
v table to Latex using latex{Hmisc}. Thanks very much for your help, Sander. Frank E Harrell Jr 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<

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

2005-05-13 Thread Sander Oom
,...) lpoints(x, y, pch=16, col="white", cex=2) panel.superpose(x, y, type="p", ...) }, par.settings= sp, auto.key= list(columns=1, x=0.7, y=0.8, corner = c(0,0)) ) Deepayan Sarkar wrote: On Friday 13 May 2005 10:36 am, Sander Oom wrote: Hi Deepayan! Deepaya

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 or in

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

2005-05-13 Thread Sander Oom
27;free',x=list(at=1:4, labels=levels(tmp$AltGeo))), xlim=c(0.5, 4.5), ylim=c(min(tmp$Lower)-1,max(tmp$Upper)+1), xlab='AltGeo', ylab='Sodium', panel = function(x, y, type, ...) { panel.xYplot(x, y, type="p",...) lpoints(x, y, pch=16

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

2005-05-13 Thread Sander Oom
tmp$xvar <- rep(1:4, each=2)+rep(c(-.05,.05), 4) xYplot(Cbind(Sodium,Lower,Upper) ~ xvar, groups=Position, data=tmp, scales=list(y='free',x=list(at=1:4, labels=levels(tmp$AltGeo))), xlab='AltGeo', xlim=c(.5, 4.5), key=list(points=Rows(trellis.par.get("superpose.

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

2005-05-13 Thread Sander Oom
y aware of this and knows a workaround? Thanks, Sander. *** \documentclass[a4paper]{article} \title{Sweave Test for summarize} \author{Sander Oom} \usepackage{a4wide} \begin{document} \maketitle \begin{figure}[ht] \begin{center} <>= # library(xtable) library(Hmisc) set.seed(11

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

2005-05-13 Thread Sander Oom
names = c("1", "2", "3", "4", "5", "6", "7", "8"), class = "data.frame") tmp$Position <- unclass(tmp$Position) xYplot(Cbind(Sodium,Lower,Upper) ~ Position|AltGeo, groups=AltGeo, data=tmp, ylim=c(mi

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

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

2005-05-05 Thread Sander Oom
(y,lower,upper) ~ month|continent, subset=sex=='male',data=dfr) xYplot(Cbind(y,lower,upper) ~ 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,

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

[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] Landscape indeces analysis methods as an R package!?

2005-03-17 Thread Sander Oom
loaded into R (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

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 wrote

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 th

Re: [R] Hosting a R Graph Gallery?

2005-02-21 Thread Sander Oom
7;m open to any suggestion. 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:

[R] Hosting a R Graph Gallery?

2005-02-18 Thread Sander Oom
providing access to all users, but with limited maintenance costs for the provider. Do others agree this could be a valuable resource? Would anybody have the resources to host such an R graph gallery? Yours, Sander Oom. -- - Dr. Sander P. Oom

Re: [R] Repeating grey scale in graph?

2005-02-16 Thread Sander Oom
tor 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: ...

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, eventhou

[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, 0.038507288,0.

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

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?

2005-01-18 Thread Sander Oom
=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black") # now a vertical one time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black") > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor0.1

[R] Time line plot in R?

2005-01-17 Thread Sander Oom
/howto/organize/images/timeline.gif The rest of the graph can be generated as in the example below. Any suggestions on how to plot the events along a time line? Thanks in advance, Sander Oom. PS: Would it be an idea to start a R gallery of graphs with sample code? I came across the 'R graph ga

RE: [R] IFELSE across large array?

2004-12-05 Thread Sander Oom
trivial, namely: A[A == 10] <- NA M[M == 10] <- NA return(A + M - 1) Then if step d) is performed first (i.e. appropriate values in A are replaced by the 'most common neighbour' [perhaps using round(mean(.., na.rm=T))] this still works, but would have to be repeated for each replicat

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

[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 DATA/NODATA

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

2004-05-31 Thread Sander Oom
ng from the gregmisc package with pad = TRUE: require(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 = Dis

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

2004-05-31 Thread Sander Oom
: unused argument(s) (i ...) > detach(XY) > Any suggestions much appreciated, Sander Oom. -- Dr. Sander P. Oom Animal, Plant and Environmental Sciences University of the Witwatersrand Private Bag 3 Wits 2050 South Africa Tel (work)

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

2004-05-17 Thread Sander Oom
) # axis.POSIXct(1, at=seq(startMonth, endMonth, by="month"), format="%m/%y") #r <- as.POSIXct(range(Time), "hours") # clock24 <- strptime(c("0","2","4","6","8","10","12","14","

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 without