[R] duplicate DATE at in lattice scale handled differently from base graphics OR lattice numeric scales

2007-07-30 Thread Alex Brown
-01)+c(2,4,4,6)), labels=list(letters[1:4] shows labels a, b, c Since this results in label c being placed at position 6, not 4, I feel this is a bug. -Alex Brown __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] How to sum one column in a data frame keyed on other columns

2006-12-13 Thread Alex Brown
Hi George I'm running ubuntu dapper badger with 2.4.0. add the line deb http://cran.R-project.org/bin/linux/ubuntu dapper/ to your /etc/apt/sources.list -Alex Brown On 13 Dec 2006, at 02:20, George Nachman wrote: Thanks, everyone, for the help! Bill: This looks like a really

Re: [R] missing factor levels in a lattice barchart panel cause unexpected failure

2006-12-12 Thread Alex Brown
causes the same error, with a different situation. Q = data.frame(X=c(NaN, 1), Y=factor(letters[1:2], letters[1:2])) barchart(~ X, Q, groups=Y) -Alex Brown panel.barchart.fixed = function (x, y, box.ratio = 1, horizontal = TRUE, origin = NULL, reference = TRUE, stack = FALSE, groups = NULL, col

[R] missing factor levels in a lattice barchart panel cause unexpected failure

2006-12-08 Thread Alex Brown
Z for different parameter Y where some Y are missing. alternative version: E = data.frame(X=c(1,2,3,4), Y=letters[c(1,2,1,2)], Z=letters[c (7,7,8,9)]); barchart(~ X | Z, E, groups=Y) I have updated to 2.4.0 and lattice 0.14-16 and the problem still exists. -Alex Brown

Re: [R] group by

2006-12-01 Thread Alex Brown
that, someone will be able to come up with a simple solution. -Alex Brown On 1 Dec 2006, at 15:22, Hans-Juergen Eickelmann wrote: Dear R-community, I started using R to control yield and output from different factories by production week. A typical example is below. LocationWeek

[R] segfault in RMySQL dbConnect error handling

2006-11-13 Thread Alex Brown
install with the following libraries: DBI_0.1-11.tar.gz RMySQL_0.5-10.tar.gz installed in a custom library location /export/downloads/R/packages (normal location seems to behave the same) note: it also failed on 2.3.0 on this machine --Alex Brown

Re: [R] Key colour problem with lattice plot

2006-10-25 Thread Alex Brown
On 23 Oct 2006, at 23:52, Deepayan Sarkar wrote: On 10/23/06, Alex Brown [EMAIL PROTECTED] wrote: Can anyone explain why the key is inverted versus the bar order? Because the key goes from top to bottom, while cartesian coordinates go from bottom to top. Neither can

Re: [R] Aggregate with multiple statistics?

2006-10-24 Thread Alex Brown
Try the summary function, which pretty much does exactly that. -Alex On 20 Oct 2006, at 23:44, Jonathan Greenberg wrote: Is there a way to calculate, say, the mean, min and max using aggregate using one line of code? Or do I need to call them separately (e.g. aggregate(...,mean);

Re: [R] problem of using list element in for cycle

2006-10-24 Thread Alex Brown
$V4, data$V5) ... -Alex Brown On 24 Oct 2006, at 05:40, Hu Chen wrote: No, I am not concerning the cat. Sorry for my misleading. another example: I have a data frame. data$V4 returns: . [6936] P05796 P11096 P76174 P04475 P18775 [6941] P33225 P76387

Re: [R] Key colour problem with lattice plot

2006-10-23 Thread Alex Brown
formulae. I would have used the following formulation: ex2 = stack(example) ex3 = cbind(country=rep(rownames(example),2),ex2) barchart(country ~ values, ex3,group=ind, auto.key=TRUE) -Alex Brown On 22 Oct 2006, at 12:21, Geoff Russell wrote: Hi, I seem to have a key colour

Re: [R] Hi,about the png device

2006-10-23 Thread Alex Brown
+ imagemagick, although it does not come with the standard R distribution - you will have to get it from CRAN, and I don't personally think the output is as nice, so far (although it has the potential to be better). -Alex Brown On 23 Oct 2006, at 14:29, lidaof wrote: Hi, Thank you

Re: [R] Key colour problem with lattice plot

2006-10-23 Thread Alex Brown
very pleased to have the power of auto.key in lattice - it's the main reason why I stopped using the default plot function. -Alex Brown __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] nested if/else very slow, more efficient ways?

2006-10-23 Thread Alex Brown
There are a number of ways this might be approached. Can you please give a sample of your data, and your desired output? Are 5a ... 5e the only values that appear in that column, or are there other values, 4e for instance, that should stay the same during your conversion? Do you wish to use

Re: [R] randomize a matrix

2006-10-20 Thread Alex Brown
, and show exactly what you mean by row and column sums? Does the order of row and column sums have to stay the same, ie: is 0 1 0 0 symmetric with 1 0 0 0 or not? -Alex Brown On 19 Oct 2006, at 20:49, Guenther, Cameron wrote: Hello

[R] Rug-like density plots on margins of figure

2006-10-19 Thread Alex Brown
similar * lattice - it has multiple graphs, but I think they may need to be homogeneous * plot + lines * plot + plot And here is the solution I am using at the moment, based upon layout. Can anyone suggest a better way to do this? -Alex Brown # some

Re: [R] Getting group size in a data frame

2006-10-19 Thread Alex Brown
I can't quite tell what you are looking for, but try the following: measurecols = c(val1,val2) df2 - df[!apply(is.na(df[1:nrow(df),measuredcols]),1,all),] to remove rows which have no measurements in. a simple count of the rows (nrow) will then give you the number of animals that didn't die,

Re: [R] creating bins for a plot

2006-10-19 Thread Alex Brown
) -Alex Brown On 18 Oct 2006, at 23:24, Jeffrey Stratford wrote: Hi. I'm trying to plot the ratio of used versus unused bird houses (coded 1 or 0) versus a continuous environmental gradient (proportion of urban cover [purban2]) that I would like to convert into bins (0 - 0.25, 0.26 - 0.5

Re: [R] write data to pdf

2006-10-19 Thread Alex Brown
.. .. .. I now would like to save the results in a pdf-file in the same format as above and add one or two plots. In R the results are written in a data frame. Franco Mendolia Original-Nachricht Von: Alex Brown

Re: [R] if statement error

2006-10-17 Thread Alex Brown
On 17 Oct 2006, at 18:34, Alberto Monteiro wrote: Jenny Stadt wrote: I was not able to make this work. I know it is a simple one, sorry to bother. Give me some hints pls. Thanks! Are you a C programmer? :-) if(length(real.d)=30 length(real.b)=30 beta1*beta2*theta1*theta20 ) { r - 1;

Re: [R] rarefy a matrix of counts

2006-10-13 Thread Alex Brown
I thought at first that you could use a weighted sample (the sample function) but, you can't since it doesn't take proper account of replacement if you try that. You can use the list approach, but through the power of R, you don't need a lot of loops to do it... I can't speak for the

[R] bug: Editing function formals deletes the environment

2006-10-13 Thread Alex Brown
First, here's the specific bug I have. Later I'll say why I care. ls(zappo) Error in try(name) : object zappo not found # good. f = function(zappo) { function(y) zappo + y } g = f(1) g(1) [1] 2 formals(g) $y formals(g)$y formals(g)$y = 2 g function (y = 2) zappo + y g(1)

Re: [R] bug: Editing function formals deletes the environment

2006-10-13 Thread Alex Brown
Ah, it's fixed in 2.4.0. I'll work around it. -Alex On 13 Oct 2006, at 11:19, Alex Brown wrote: First, here's the specific bug I have. Later I'll say why I care. ls(zappo) Error in try(name) : object zappo not found # good. f = function(zappo) { function(y) zappo + y } g = f(1) g(1

Re: [R] multiply two matrixes with the different dimension column by column

2006-10-13 Thread Alex Brown
apply(Y, 2, function(y)list(y*X)) On 13 Oct 2006, at 12:33, Majid Iravani wrote: Dear all, I would like to multiply two matrixes with the different dimension column by column. Let make an example: If I have two matrixes X and Yas follow: X- matrix(1:12, nrow=4, ncol=3,

Re: [R] read.table() and scientific notation

2006-10-10 Thread Alex Brown
A cheeky solution by subverting the coerce mechanism and read.table: # install a coerce function which can fix the e+10 syntax for an imaginary class myDouble: setAs(character, myDouble, function(from)as.double(sub('^(-?) e','\\11e',from))) Warning message: in the method signature for

[R] Fwd: read.table() and scientific notation

2006-10-10 Thread Alex Brown
note: this e-mail is supposed to precede my coerce hack one. As an example of the other posters mentioning colClasses, with some debugging notes: # create a pretend file for this example Lines - scan(sep=\n, what=) a 1 3e-8 b 2 1e+10 c 3 e-10 d 4 e+3 file - textConnection(Lines) #

Re: [R] find weighted group mean

2006-10-10 Thread Alex Brown
You can do it directly from the X matrix like so: by(X, as.list(as.data.frame(X[,3:5])), function(R)weighted.mean(R [1], R[2])) A: 0 B: 0 C: 0 [1] 0.4912458 A: 1 B: 0 C: 0 [1] NA

Re: [R] How to repeat vectors ?

2006-09-30 Thread Alex Brown
Solution: m[rep(1:nrow(m),each=2),] Explanation: There is a simple and effective way to do this, using array slices. for your input matrix, m: m=matrix(paste(a,c(11,12,21,22),sep=),2) m [,1] [,2] [1,] a11 a21 [2,] a12 a22 you want to create [,1] [,2] [1,] a11 a21 [2,] a11

Re: [R] problems with R and tckl/tk on Mac OS X

2006-09-29 Thread Alex Brown
the gui interface: http://cran.r-project.org/bin/macosx/R-2.3.1.dmg -Alex Brown On 29 Sep 2006, at 08:04, Ingo wrote: Dear R-help team, I am trying to run R on my Intel-based Mac. I have installed R, X11 and Tcl/TK (I thought), but the GUI doesn't run. My system administrator doesn't

[R] pdf and postscript sizes - change on each page?

2006-09-27 Thread Alex Brown
Hi All The device commands pdf and postscript allow you to specify the width and height of a page. However, each subsequent plot is drawn on a separate page. Is there a way to change the page size part way through? For instance, is there an equivalent to the function pdfresize below?

[R] Rotate legends or other approaches to nice legend placement?

2005-07-04 Thread Alex Brown
is allocated beneath the graph for the legend 4) draw legend 5) allow user to call plot, correctly drawing the plot in the remaining frame? I have taken a look at this, but I am confused by the different units used by par(mar), legend(plot=F), and layout. -Alex Brown