Skip to content
Back to formatted view

Raw Message

Message-ID: <OF933405E8.08627FC3-ONC1257589.0033EC0F-C1257589.00344226@precheza.cz>
Date: 2009-03-30T09:32:23Z
From: PIKAL Petr
Subject: Odp:  How to generate a new column according to some rule?
In-Reply-To: <551b80f5-9409-48ef-87ac-b1d32d49d423@n7g2000prc.googlegroups.com>

Hi

r-help-bounces at r-project.org napsal dne 30.03.2009 05:17:35:

> In a data frame I have a column "date" and a column "time",now I want
> to generate a new column which is the mean of the value of time group
> by date. In stata the command is
> 
> egen scalls = mean(time),by(date)
> 
> but I don't know the command in R, can anybody help me?

In R you can use 

?tapply
?by
?aggregate

from base or functions from
?doBy package.

Regards
Petr



> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.