Search Archives
Search tips
from:Name
Search by author name, e.g. from:Duncan Murdoch
"exact phrase"
Match an exact phrase
word1 word2
Match messages containing both words
Date range
Use the date pickers to filter results to a time period
Use the list dropdown to narrow results to a specific mailing list. Combine from: with other terms to filter by author and content.
Hi, You could use an anonymous function to operate on each `year-block' of your dataset, then assign the result as a new column: d <- data.frame(year=c(rep(2001, 3), rep(2002, 3)), num=c(25,75,150...
You could convert your data from a wide format to a long format using the reshape function in base R: DF2 <- reshape(DF, direction="long", idvar=names(DF)[1:3], varying=c("site1_elev", "site1_temp", "site2_elev", "site2_temp...
Hi, It may help that: aggregate(DF$total, list(DF$note, DF$id, DF$month), mean) should give you means broken down by time slice (note), id and month. You could then subset means for GA or GB from the...
Hi Jeff, Why do you say ave() is better suited *because* it always returns a vector that is just as long as the input vector? Is it because that feature (of equal length), allows match() to be avoided, and as...
Hi Val, The by() function could be used here. With the dataframe dfr: # split the data by first name and check for more than one last name for each first name res <- by(dfr, dfr['first'], function(x) length(unique...
aggregate(), tapply(), do.call(), rbind() (etc.) are extremely useful functions that have been available in R for a long time. They remain useful regardless what plotting approach you use - base graphics, lattice or the more recent ggplot. Philip On 22...
Val, Working with R's special missing value indicator (NA) would be useful here. You could use the na.strings arg in read.table() to recognise "-" as a missing value: dfr <- read.table( text= 'first week last Alex 1 West...
Hi Luigi, I'm afraid I don't understand your toy data as you've described it, but if you really don't have run 2 for target A, and don't have run 1 for target B, why not...
Hi Naresh, You could calculate the ranges explicitly and then supply to scales(): holdRange <- vector('list', length(unique(my.df$name))) for(i in 1:length(holdRange)){ holdRange[[i]] <- rev(range(my.df$x[my.df$name==unique(my.df...
Hi, As Jeff said, more than one grouping variable can be supplied, and there is an example at the bottom of the help page for ave(). The same goes for by(), but the order that you supply the grouping variables...
Can't find what you're looking for? Try searching with Google .