Thanks again!
On Thu, Dec 3, 2009 at 2:19 PM, David Winsemius wrote:
>
> On Dec 3, 2009, at 2:14 PM, Peng Cai wrote:
>
> Also, can I control for number of decimal places printed. Like when I use
> "mean" function. By default it shows upto 7 dec. Thanks!
>
>
> > print(4.567891234, digits=3)
> [1]
On Dec 3, 2009, at 2:14 PM, Peng Cai wrote:
> Also, can I control for number of decimal places printed. Like when
> I use "mean" function. By default it shows upto 7 dec. Thanks!
> print(4.567891234, digits=3)
[1] 4.57
>
>
> On Thu, Dec 3, 2009 at 2:08 PM, Peng Cai
> wrote:
> Thanks Davi
Also, can I control for number of decimal places printed. Like when I use
"mean" function. By default it shows upto 7 dec. Thanks!
On Thu, Dec 3, 2009 at 2:08 PM, Peng Cai wrote:
> Thanks David for your suggestions.
>
>
> On Thu, Dec 3, 2009 at 2:03 PM, David Winsemius wrote:
>
>>
>> On Dec 3,
Thanks David for your suggestions.
On Thu, Dec 3, 2009 at 2:03 PM, David Winsemius wrote:
>
> On Dec 3, 2009, at 1:50 PM, Peng Cai wrote:
>
> Hi R Users,
>>
>> I'm wondering how can I calculate two (or three) way sum of a variable. A
>> sample data is:
>>
>> State Month Year Value
>> NC Jan 1996
On Dec 3, 2009, at 1:50 PM, Peng Cai wrote:
Hi R Users,
I'm wondering how can I calculate two (or three) way sum of a
variable. A
sample data is:
State Month Year Value
NC Jan 1996 1
NC Jan 1996 2
NC Feb 1997 2
NC Feb 1997 3
NC Mar 1998 3
NC Mar 1998 4
NY Jan 1996 4
NY Jan 1996 5
NY Feb 19
Thanks Greg, Jorge, and Jim for your help.
Peng
On Thu, Dec 3, 2009 at 1:58 PM, jim holtman wrote:
> try this:
>
> > x
>State Month Year Value
> 1 NC Jan 1996 1
> 2 NC Jan 1996 2
> 3 NC Feb 1997 2
> 4 NC Feb 1997 3
> 5 NC Mar 1998 3
> 6
Hi Peng,
Here is a suggestion using tapply:
R> with(x, tapply(Value, list(State, Month), FUN = sum))
R> with(x, tapply(Value, list(State, Year), FUN = sum))
R> with(x, tapply(Value, list(State, Year, Month), FUN = sum))
with 'x' your data set. Please take a look at ?tapply for more information.
try this:
> x
State Month Year Value
1 NC Jan 1996 1
2 NC Jan 1996 2
3 NC Feb 1997 2
4 NC Feb 1997 3
5 NC Mar 1998 3
6 NC Mar 1998 4
7 NY Jan 1996 4
8 NY Jan 1996 5
9 NY Feb 1997 5
10NY Feb 1997
?tapply
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Peng Cai
> Sent: Thursday, December 03, 2009 11:50 AM
9 matches
Mail list logo