[R] How to perform arithmetic across rows

2010-10-28 Thread Nick Ackerman
Hi All, I have a data frame (myframe) with variables (columns) A,B,C and 100 records (rows) for each. Column A is numeric. I would like to append a column to myframe that subtracts the value in row 24 of A from row 1 of A. In this procedure the first 23 rows of the new column will necessarily be

Re: [R] Add title to color spectrum legend in xyplot

2010-03-26 Thread Nick Ackerman
Thanks Deepayan, That's an easy fix and provides a nice graph. Nick -- View this message in context: http://n4.nabble.com/Add-title-to-color-spectrum-legend-in-xyplot-tp1678456p1692375.html Sent from the R help mailing list archive at Nabble.com. __

[R] Add title to color spectrum legend in xyplot

2010-03-22 Thread Nick Ackerman
Hi, I have a plot that is essentially the same as that in Figure 5.6 of "Lattice - Multivariate Data Visualization with R". The key difference is that I would like to add a title to top of the grey color spectrum legend, but have thus far been unsuccessful. I've tried a variety of options, but to

[R] How can I return rows from a data frame with maximum value by factor?

2010-03-17 Thread Nick Ackerman
Hi, I'm new to R and new to this forum. I'm struggling with trying to extract certain rows of data from my data.frame. The data.frame has eleven columns. Among those columns are "FISH_ID" and "DATE_TIME". FISH_ID is a factor. For each of my 21 unique FISH_IDs (levels) I have a few to a few thousa

Re: [R] How can I return rows from a data frame with maximum value by factor?

2010-03-17 Thread Nick Ackerman
Solved my own question by looking at some other threads. For those who may be intersted, here was the solution to my problem. do.call(rbind,lapply(split(data.frame,FISH_ID),function(x)x[which.max(x$DATE_TIME),])) -- View this message in context: http://n4.nabble.com/How-can-I-return-rows-from-a