[R] pairs() uses col argument for axes coloring
Hi list, not sure if this is the wanted behavior, but running the following code: version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R n - 500 d - 4 m - matrix(runif(n*d, -1, 1), ncol=d) c - hsv(apply(m, 1, function(x) {sum(x*x)/d}), 1, 1) pairs(m, col=c) gives me the desired coloring of the points but also colors the axes. Looking at the source for pairs() suggests, that this is the case because col is part of the ... argument list which is passed on to localAxis (and from there to axis). Wouldn't it be more approptiate to use the same color box() uses to draw the border around each scatterplot? If yes, should I open a bug for this or how would such a feature request be handled? -- Olaf Mersmann __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to duplicate rows in dataframe?
Hi Christian, cstrato wrote: Dear all: *snip* However consider the following vector: x - c(13,32,13,24,46,24,24) Now I want to get the dataframe in the order of the rows defined in x, i.e. the dataframe contains duplicate rows. One way to achieve this would be to use rbind in a for-loop. My question is: Is there an easier and - more important - faster way to obtain the dataframe as defined in x? ?unique ?sort HTH Olaf __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] points plotting
Hi m p, m p wrote: Hello, I use points(a,b,pch=20,col=black) or pch=19 but in both cases bullets are too large. Is the a way to decrease the size of the bullet - but be larger than a period. Try ?plot.default and read the entry for 'cex' HTH Olaf __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Evaluate a function for various value of parameters
Hi Stephane, * Stephane DRAY [EMAIL PROTECTED] [041023 00:20]: Hello list, I have a problem ... and do not know how to solve it. I would like create a function that estimate the quality of the fit of different functions with different values of parameters. This problem is related to the following one: I would like to create a function evaluatemyfunction which evaluate a function f for different values of parameters. For instance, if f=function(a,b) a*b evaluatemyfunction(f,1:10,5) would return: 5 10 15... I would like that f could have a variable number of arguments. I have begin to write a function: That function has already been written for you. Lookup 'mapply' in the online help. HTH Olaf __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dotplot lattice problems: y axis values and bg color output in jpg
Hi Paul. * Paul Johnson [EMAIL PROTECTED] [041023 00:24]: *snip* That is the dotplot one. The picture is basically the same, except the numbers on the y axis only go up to 8. But the dots are in the correct spots and the x axis is labeled correctly. Unless RENUCYC is a factor, a dotplot makes little sense. Afaik you're looking for an xyplot. On the screen, the plots have white backgrounds, but the picture from the dotplot turns out gray. Why is that? It's the default lattice color sheme which makes for easier viewing on computer screens. Sometimes, if I run another lattice plot in the same session, the colors change to the dark background, and I suppose the same trouble is happening. Isn't trellis.par.set() going to remain in place for all following trellis plots? To quote the manual: Once a device is open, it's settings can be modified. When another instance of the same device is opened later using trellis.device, the settings for that device are reset to its defaults, unless otherwise specified in the call to trellis.device. HTH Olaf __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to randomize a set of integers in R
Hi Susanne, * Susanne Osterkamp [EMAIL PROTECTED] [040819 15:52]: Hello, I want to validate my data for working with CART. I need to now how to create a randomized column of some 6800 intgers within R. Do you want to sample 6800 random integers? In that case try ?runif (for uniform distribution) If you want to resample 6800 integers try ?sample HTH Olaf Mersmann __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Grouping data.frames
Hello all, I'm new to R (and the S language in general) so go easy on me if this is really simple. Given a data.frame df which looks like this: f1 f2 f3 f4 c1 c2 1 y y a b 10 20 2 n y b a 20 20 3 n n b b8 10 4 y n a a 30 5 I'd like to aggregate it by the factors f1 and f2 (or f2 and f3, or any other combination of the three) and compute the sum of c1 and c2 (as separate values). I can do this just fine as long as there is only one column with counts using tapply of mApply out of Hmisc, but I've been unable to come up with a solution that works with two or more columns. In SQL a query to achieve this would look something like this: SELECT f1, f2, sum(c1), sum(2) FROM df GROUP BY f1, f2 An hints on how this is done efficiently in R would be greatly appreciated. Thanks, Olaf Mersmann __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html