Displaying 11 results from an estimated 11 matches for "omphalodes".
2012 Dec 15
3
kruskalmc, significant differences while median values are the same
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 samples in groups vary from 50 to 4900.
Thanks to all, OV
.
2012 Jun 26
5
chisq.test
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), ncol = 4, byrow = TRUE)
dimnames(tabela) <- list(
2012 Nov 17
3
transform input argument (matrix) of function
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) {
xy <- cbind(xy[,1], xy[,2], xy[,1] + xy[,2])
return(xy)
}
df1 <- matrix(c(1,2,3,1,2,3), ncol =
2012 Nov 07
1
row index for max values of row groups
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,3,2,1,4,3)
)
df1
expected results
> 4 8 11 # row index of max values by group
2012 Apr 07
1
rgeos - gBuffer, width by z-value
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[,1:2],point)
plot(point_shp, xlim = c(0,30), ylim = c(0,20))
plot(gBuffer(point_shp, width = 5,
2012 Nov 20
2
correct function formation in R
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:
input <- data.frame(x1 = rnorm(20), x2 = rnorm(20), x3 =
2011 Oct 01
1
class definition
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 any advice / suggestions, how
2011 Oct 22
1
setMethod "[" - extract by names within Slot
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)
}
setMethod("[",
2012 Feb 28
1
colour by z value, persp in raster package
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(z)
persp(r1)
There already exist some function to produce persp plot for anothe
2012 Apr 15
1
match values from data.frame and vector
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))
I would like to get vector x2:
> x2
[1] 5 5 5 NA NA 6
2012 Oct 30
1
mapply instead for loop
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", "z")
head(xyz)
size <- 2
output <- NULL
### for