[R] sapply to return factors in dataframe

2007-08-30 Thread Alexander.Herr
Hi List, I am trying to randomise a dataframe with mixed factors/numeric variables and return a new (randomised) dataframe with the same columns (as factors/numeric). simgap-function(x) { ma-max(x) mi-min(x) Xout-runif(length(x),min=mi,max=ma) return(Xout) } rdize.dta-function(x){

[R] FW: sapply to return factors in dataframe

2007-08-30 Thread Alexander.Herr
Ahhrg List, there was a hitch in the previous code. Updated and functional version follows after my initial question: I am trying to randomise a dataframe with mixed factors/numeric variables and return a new (randomised) dataframe with the same columns (as factors/numeric). simgap-function(x)

[R] creating unique and sorted values by combining columns

2007-08-13 Thread Alexander.Herr
Hi List, I am combining column values of a dataframe to create a new variable that is the sorted and unqiue combination of the columns (and excluding 0). The following works, but surely there is a more elegant way of doing this? t1-NULL for(i in 1:nrow(tmp)) { if(i == 1){ sort(c(tmp[i,1],

[R] plot table with sapply - labeling problems

2007-08-08 Thread Alexander.Herr
Hi List, I am trying to label a barplot group with variable names when using sapply unsucessfully. I can't seem to extract the names for the indiviual plots: test-as.data.frame(cbind(round(runif(50,0,5)),round(runif(50,0,3)),roun d(runif(50,0,4 sapply(test, table)-vardist sapply(test,

[R] cluster - identify variables contributions to clusters of cases

2007-07-27 Thread Alexander.Herr
Hi List, How would I go about best identifying the variables contributing most to the specific clusters? eg using either aglomerative or partitioning methods, but with mixed variables (ie including categorical) eg: factor(as.integer(runif(min=1, max=5,nrow(USArrests-t1

[R] capture numeric(0) with if statement

2007-07-23 Thread Alexander.Herr
Hi List, I am trying to capture the numeric(0) with an if statement, unsucessfully: test-numeric(0) if(test == numeric(0)) print(test is, test) I get: Error in if (test == numeric(0)) print(test is, test) : argument is of length zero How can I capture the numeric(0) condition? Any

[R] Gap statistics (Tibshirani et al 2001) for Categorical data

2007-07-10 Thread Alexander.Herr
Hi list, has anyone implemented the Gap statistic for clusters based on categorical/mixed data? Slmisc (and SAGx) only work on numerical data. Any suggestions welcome Thanks Herry __ R-help@stat.math.ethz.ch mailing list

[R] ?replace characters within vector data

2007-07-05 Thread Alexander.Herr
Hi List, I want replace characters within a vector. Outside R I could use sed, but I'd like to automate it in R. For example vectorx xxxyyz xxxyyza xxxyyzzb I want to change to: vectorx aaayyz aaayyza aaayyzzb The obvious replace command only deals with whole data entries? Any hints would

[R] for loop doesn't stop with upper loop value

2007-07-03 Thread Alexander.Herr
Hi list, could anyone please educate me on the following: lst-seq(47, 239, by=12) for(n in lst) { lower=n; upper=lower+10 for(i in lower+2 : upper) { print(paste(n, i: , i, lower: ,lower, upper :, upper)) } } does not stop when i = upper A while loop fixes this but, I

[R] blotched y-axis text in plot function

2007-06-13 Thread Alexander.Herr
Hi List, I have recently upgraded to opensuse10.2 and R 2.5 (compiled from source). Now, whenever I use plot the y-axis and labels are black blotches while x-axis and labels are fine. Using demo(graphics) this occurs with plot/boxplot/hist/pairs/coplot but not in the pie graphs and in the The

Re: [R] blotched y-axis text in plot function

2007-06-13 Thread Alexander.Herr
Hi List, can I retract the query below? It turns out that it has to do with the NX viewer/server. It works fine with the vncviewer/server, so please ignore... Thanks Herry Dr Alexander Herr - Herry Spatial and statistical analyst CSIRO, Sustainable Ecosystems Davies Laboratory, University

Re: [R] error: GLX extension missing on server

2007-05-28 Thread Alexander.Herr
Thanks Brian, I have Load glx in the Module section of xorg.conf - However, based on my latest probing the graphics card is not in the opensuse xgl database, and the 3D acceleration is not enabled. So I will have to wait till a new package comes available with the driver for the intel GMA

[R] error: GLX extension missing on server

2007-05-17 Thread Alexander.Herr
Hi List, when loading library(rgl) I get error RGL: GLX extension missing on server. I have Mesa and xgl installed, but xgl info sais its an highly experimental code. Does this mean I shouldn't bother for a while with opengl or are there alternatives? Any help appreciated Thanx Herry R 2.4.1

[R] rgl.postscript{rgl} crashes R

2007-01-31 Thread Alexander.Herr
Hi list, I am trying to print a rgl scene. I can do this with rgl.snapshot(test.pnt,fmt=png), but rgl.postscript(test.pdf,fmt=pdf) does crash R and returns to the linux shell after extented time period. I am running R 2.4.0 on i686 linux mandrake 10.2. Do I need any other R external program to

Re: [R] surface3d grid from xyz dataframe

2006-12-18 Thread Alexander.Herr
Thanks Duncan, yes it is surface3d{rgl} I am trying. Unfortunately your solution doesn't work with the data (I get a subscript out of bounds error, after converting to integer and assigning the matrix to z via z[cbind(data$x, data$y)] - data$z). As outlined previously, I have a dataframe with

[R] surface3d grid from xyz dataframe

2006-12-17 Thread Alexander.Herr
Hi List, I am trying to plot a grid with an overlayed height. I have a dataframe with four variables: x,y,gridvalue,height. The dataframe has 2.5mio observations (ie grid points), I assign colors through the gridvalue using map_color_gradient thus producing: x,y,gridvalue,height,gridcol as

Re: [R] [R-sig-Geo] plot() and Jpeg() increase font size and resolution

2006-11-27 Thread Alexander.Herr
Hi Edzer, png also does not increase the file size. Following the commands. The data are located at ftp://ftp.csiro.au/Herry, file qldproperty.Rdata. trellis.par.get(fontsize)-fontsize fontsize$default-16 fontsize$points-16 fontsize$text-18

Re: [R] [R-sig-Geo] plot() and Jpeg() increase font size and resolution

2006-11-26 Thread Alexander.Herr
Thanks to Edzer and Roger, I can now plot with increased font sizes. However, jpeg still does not reproduce these, nor does it show up in high quality. What I would like to do is produce some highresolution jpegs. Any help would be appreciated Thanx Herry R2.4 on Mandriva 10.2 linux. Dr

[R] plot() and Jpeg() increase font size and resolution

2006-11-23 Thread Alexander.Herr
Dear list, I am having troubles increasing the fontize when plotting a variogram{gstat} and its model (vgm) with plot and using jpeg(). Also the resolution in the jpeg call does not work. I am using R2.4 on Mandriva 10.2 linux. I can change fontsize with cex.axis in a normal plot, so I presume

RE: [R] Basic matematical functions with NAs

2005-05-25 Thread Alexander.Herr
Conceptually your assumption is wrong: If you have the traps out and don't catch fruit in the trap than you have 0 captures. NA would come for example from a trap not functioning properly at a certain day. To get R to recognize NA you need to define your variables as numeric or factors.

[R] R-crash using read.shape (maptools)

2004-04-28 Thread Alexander.Herr
Hi List, I am trying to read a large shapefile (~37,000 polys) using read.shape [winxp, 1gig ram, dellbox). I receive the following error: AppName: rgui.exeAppVer: 1.90.30412.0ModName: maptools.dll ModVer: 1.90.30412.0 Offset: 309d The getinfo.shape returns info, and the

[R] Error while loading R2HTML in Rprofile

2004-04-19 Thread Alexander.Herr
Hi List, When loading library(R2HTML) in Rprofile I get the following error: Error in firstlib(which.lib.loc, package) : couldn't find function ps.options Error in library(R2HTML) : .First.lib failed [Previously saved workspace restored] % ps.options is there % Loading the library from

[R] npmc output

2003-12-02 Thread Alexander.Herr
Hi List, Can anyone help with further documentation on the npmc output (library npmc). I can't find details in Munzel Hothorn's paper. Specifically I am looking for differences (wrt interpretation) of the p-value 1s: the 1-sided p-value and p-value 2s: the 1-sided p-value. Any help