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 just create another factor that reflects this, and
plot that?
my.data$clus2 <- with(my.data, interaction(cluster, target)
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/02/2017 8:40 AM, C W wrote:
Hi Carl,
ne pass.
If your data set is really big (running out of memory big) then you
might
want to investigate the data.table or sqlite packages, either of
which can
be combined with dplyr to get a standardized syntax for managing
larger
amounts of data. However, most people actually aren't running ou
in one pass.
If your data set is really big (running out of memory big) then you
might want to investigate the data.table or sqlite packages, either of
which can be combined with dplyr to get a standardized syntax for
managing larger amounts of data. However, most people actually aren't
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(x$last)) > 1)
# make the result more easily manipulated
res <- as.table(res)
res
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 aggregated dataframe.
Philip
On 27/11/2016 3:11 AM, lily li wrote:
Hi R users,
I'm trying
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$name)[i]]))
}
holdRange
# [[1]]
# [1] -5.052890 -9.967
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 becomes
important. Whichever grouping variable is supplied first to by() will
chang
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,30,85,95))
d$diff <- unlist(by(d$num, d$year, function(x) x - x[1]))
d
year n
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"),
v.names=c("elev", "temp"),
times=1:2
10 matches
Mail list logo