[R] two active RGL device / linked devices

2014-02-04 Thread Omphalodes Verna
Dear list! My question is, if there is an option in RGL, that two devices can be active. It means, when eg. points in first device is rotated also points in second devies is rotated. For example: library(rgl) x <- rnorm(1000) y <- rnorm(1000) z <- rnorm(1000) open3d() points3d(x,y,z) open3d() p

[R] truncated cone / frustum in R rgl

2014-01-31 Thread Omphalodes Verna
Dear list! Here is a simplified script for cone in RGL (from rgl demos). I would like to draw a truncated cone / frustum using RGL in R. Do you have any suggestion how to modify code? Thanks a lot, OV library(rgl) cone3d <- function(base=c(0,0,0), tip=c(0,0,1), rad=1, n=30) {     trans <- d

Re: [R] kruskalmc, significant differences while median values are the same

2012-12-16 Thread Omphalodes Verna
ree species right solution?  thanks, OV ________ From: Thomas Lumley To: Omphalodes Verna Cc: R Help Sent: Sunday, December 16, 2012 11:59 PM Subject: Re: [R] kruskalmc, significant differences while median values are the same On Sat, Dec 15, 2012 at 10:04 PM, Omphalodes Verna wrote: De

[R] kruskalmc, significant differences while median values are the same

2012-12-15 Thread Omphalodes Verna
Dear list! I work with multiple Kruskal-Wallis test (kruskalmc, package pgirmess), which evaluates differences in medians among groups (5 groups). A result of a test is significant differences among some groups, while median values are the same for 4 groups (using tapply). Why? p.s.: number of

[R] correct function formation in R

2012-11-20 Thread Omphalodes Verna
Dear list!   I have question of 'correct function formation'. Which function (fun1 or fun2; see below) is written more correctly? Using ''structure'' as output or creating empty ''data.frame'' and then transform it as output? (fun1 and fun1 is just for illustration).   Thanks a lot, OV   code: i

[R] transform input argument (matrix) of function

2012-11-17 Thread Omphalodes Verna
Dear list!   I would like to write a function to transform matrix, which is input argument of a written function. It is easy with new matrix (see below), but my idea is to transform input argument (matrix) of function without any additional matrixes. Here is an example: fun1 <- function(xy) { x

Re: [R] row index for max values of row groups

2012-11-08 Thread Omphalodes Verna
Thansk for help to all.   OV From: William Dunlap Cc: R help ; Omphalodes Verna Sent: Wednesday, November 7, 2012 8:38 PM Subject: RE: [R] row index for max values of row groups Note that the unlist(tapply()) algorithm depends on the groups column being

[R] row index for max values of row groups

2012-11-07 Thread Omphalodes Verna
Dear list members! I am looking for ''nice solution'' for (maybe) simple problem. I need a code (small program) to calculate row index for max value (example below: df1$values) by groups (example below: df1$groups). df1 <- data.frame( groups = c(1,1,1,1,1,2,2,2,3,3,3,3), values = c(1,1,1,2,1,1,2,

Re: [R] mapply instead for loop

2012-11-03 Thread Omphalodes Verna
Thanks for help.   But, I am surprised, that mapply is slower than for loop?   OV     From: Uwe Ligges Cc: "r-help@r-project.org" Sent: Saturday, November 3, 2012 4:32 PM Subject: Re: [R] mapply instead for loop On 30.10.2012 20:01, Omphal

[R] mapply instead for loop

2012-10-30 Thread Omphalodes Verna
Hi all!   My question in about using mapply instead for loop. Below is a example with for loop: Is it posible to give same results with mapply function?   Thanks for help!   OV   x <- 1:10 y <- 1:10 xyz <- data.frame(expand.grid(x,y)[1], expand.grid(x,y)[2], z = rnorm(100)) names(xyz) <- c("x", "y

Re: [R] chisq.test

2012-06-27 Thread Omphalodes Verna
Dear all! Thanks for clarification. OV To: Rolf Turner Sent: Wednesday, June 27, 2012 1:33 PM Subject: Re: [R] chisq.test Hi Rolf, Thanks for spotting the mistake.  A.K. - Original Message - From: Rolf Turner .org> Sent: Wednesday, June 2

[R] chisq.test

2012-06-26 Thread Omphalodes Verna
Dear list! I would like to calculate "chisq.test" on simple data set with 70 observations, but the output is ''Warning message:'' Warning message: In chisq.test(tabele) : Chi-squared approximation may be incorrect Here is an example:         tabele <- matrix(c(11, 3, 3, 18, 3, 6, 5, 21), nco

[R] match values from data.frame and vector

2012-04-15 Thread Omphalodes Verna
Dear R helpers! I have a vector 'x1' and data.frame 'df1'. Do you have any suggestion how to get vector x2, which will be a result of matching values from vector 'x1' and values from 'df1'? Please, see the example: x1 <- c(rep(1,3), rep(NA,2), rep(2,4)) df1 <- data.frame(c1 = c(1,2), c2 = c(5,6

Re: [R] rgeos - gBuffer, width by z-value

2012-04-07 Thread Omphalodes Verna
isible(lapply(l, plot, add = TRUE)) Cheers, Mike. On Sat, Apr 7, 2012 at 9:14 PM, Omphalodes Verna > Dear list! > > I have problem with buffer size (width) in package rgeos. I would like to > expand given geometry (points) to specified width based on the z value from > attribute t

[R] rgeos - gBuffer, width by z-value

2012-04-07 Thread Omphalodes Verna
Dear list! I have problem with buffer size (width) in package rgeos. I would like to expand given geometry (points) to specified width based on the z value from attribute table. Here is example: point <- data.frame(x=c(10,20), y=c(10, 10), z = c(2,7)) point_shp <- SpatialPointsDataFrame(point[

Re: [R] colour by z value, persp in raster package

2012-02-28 Thread Omphalodes Verna
quot;raster".   Thanks all!   OV   From: David Winsemius Cc: "r-help@r-project.org" Sent: Tuesday, February 28, 2012 8:47 PM Subject: Re: [R] colour by z value, persp in raster package On Feb 28, 2012, at 4:34 AM, Omphalodes Verna wrote: >

[R] colour by z value, persp in raster package

2012-02-28 Thread Omphalodes Verna
Hi all!   My question is how to colour pixels by z value in persp plot in raster package. Here is an example:     x <- seq(-1.95, 1.95, length = 30) y <- seq(-1.95, 1.95, length = 35) z <- outer(x, y, function(a,b) a*b^2) r1 <- raster(nrows=35, ncols=30, xmn=0, xmx=30, ymn = 0, ymx = 35) r1[] <- c

[R] eliminate rows with all NA values in matrix of special class

2012-02-04 Thread Omphalodes Verna
Dear list! I have a problem with eliminate rows with all NA values in matrix of special class ("my.class"). Belowe is a example: #class definition setClass("my.class", representation(ID="character",  years="integer",  my.mat="matrix")) data.1 <- new("my.class", ID = c("tA", "tB", "tC"), year

Re: [R] setMethod "[" - extract by names within Slot

2011-10-22 Thread Omphalodes Verna
quot;] #works a[5:20, "B"] #works It works, but Is it normal to write two codes for setMethod??? Nice weekend, OV From: Martin Morgan Cc: "r-help@r-project.org" Sent: Saturday, October 22, 2011 3:50 PM Subject: Re: [R] setMethod &q

[R] setMethod "[" - extract by names within Slot

2011-10-22 Thread Omphalodes Verna
Hi R-helper! I have problem with setMethods for "[". Here is example : setClass("myClass", representation(ID.r = "numeric", ID.c = "character", DAT = "matrix")) to.myClass <- function(ID.r, ID.c, DAT) {     out <- new("myClass", ID.r = ID.r, ID.c = ID.c, DAT = DAT)     return(out)   }  

[R] class definition

2011-10-01 Thread Omphalodes Verna
Hi everybody! I have a matrix of class "myClass", for example: myMat <- matrix(rnorm(30), nrow = 6) attr(myMat, "class") <- "myClass" class(myMat) When I extract part of ''myMat'', the corresponding class ''myClass'' unfortunately disappear: myMat.p <- myMat[,1:2] class(myMat.p) Please for a