[R] Getting the latex file from R CMD check

2012-12-10 Thread Guillaume Chapron
Hi list, I'm running R CMD check for a package and I would like to save the .tex file that generates later the pdf documentation. I have only seen it appearing and disappearing quickly in a tmp folder but I have not been able to save it. I could not find any option to the check command to

[R] Smoothing a persp graph

2012-06-19 Thread Guillaume Chapron
Hi, I'm unable to find a way to smooth data for a persp() graph. Example, suppose that I have data x,y,z like this: x - 1:10 y - 1:10 k - 20 z - outer(x, y, *) + matrix( k*runif(100, -1, 1), 10, 10) persp(x, y, z, theta = 35, phi = 25) The graph is not very nice. Is there a way to smooth the

Re: [R] Smoothing a persp graph

2012-06-19 Thread Guillaume Chapron
On Jun 19, 2012, at 10:02 AM, David L Carlson wrote: kde2d is for two dimensional data. The persp graph is 3d. Huh? The question asked about plotting data that was 2d. The third dimension was to be the density. kde2d in package MASS or the similarly named function in package KernSmooth would

[R] Mersenne-Twister RNG

2009-03-01 Thread Guillaume Chapron
Hello, I have a question regarding the default RNG in R. The helps indicate that : The default is Mersenne-Twister. From Matsumoto and Nishimura (1998). A twisted GFSR with period 2^19937 - 1 and equidistribution in 623 consecutive dimensions (over the whole period). The ‘seed’ is a

[R] Lattice: how to have multiple wireframe nice intersection?

2009-01-16 Thread Guillaume Chapron
Hello, This code builds a simple example of 2 wireframes : require(lattice) x - c(1:10) y - c(1:10) g - expand.grid(x = 1:10, y = 1:10, gr = 1:2) g$z - c(as.vector(outer(x,y,*)), rep(50,100)) wireframe(z ~ x * y, data = g, groups = gr, scales = list(arrows = FALSE)) However, the

[R] Linked count between matrix columns

2009-01-15 Thread Guillaume Chapron
Hello, I create this array: x - cbind(c(1:4, rep(0,10)), c(rep(0,4), 1:2, rep(3,6), 4,5)) [,1] [,2] [1,]10 [2,]20 [3,]30 [4,]40 [5,]01 [6,]02 [7,]03 [8,]03 [9,]03 [10,]03 [11,]03 [12,]0

Re: [R] Linked count between matrix columns

2009-01-15 Thread Guillaume Chapron
Thank you! This is exactly what I wanted. Could you please explain the logic behind your code? x[,2][x[,1][x[,1] 0]] - table(x[,2])[as.character(x[,1][x[,1] 0])] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Linked count between matrix columns

2009-01-15 Thread Guillaume Chapron
table(x2)[as.character(x[,1][x[,1] 0])] Why do I need as.character() here? I checked it does not work without, but I don't see why. The help says as.character attempts to coerce its argument to character type. Thanks very much! Guillaume __

Re: [R] Linked count between matrix columns

2009-01-15 Thread Guillaume Chapron
Because we want the values in table(x[,2]) where the **names** are as.character(x[,1][x[,1] 0])], not the positions x[,1][x[,1] 0])]. Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Randomly remove condition-selected rows from a matrix

2008-12-31 Thread Guillaume Chapron
I believe this does what you want: m[-sample(which(m[,1]8 m[,2]12),2),] Analysis: Get a boolean vector of rows fitting criteria: m[,1]8 m[,2]12 What are their indexes? which(...) Choose two among those indexes: sample(...,2) Thanks, but this does not seem to always work.

[R] Randomly remove condition-selected rows from a matrix

2008-12-30 Thread Guillaume Chapron
Hello all, I create the following matrix: m - matrix(1:20, nrow = 10, ncol = 2) which looks like: [,1] [,2] [1,]1 11 [2,]2 12 [3,]3 13 [4,]4 14 [5,]5 15 [6,]6 16 [7,]7 17 [8,]8 18 [9,]9 19 [10,] 10 20 Then, I want to