Re: [R] How to use tapply with more than one variables grouped

2012-10-24 Thread arun
"NY" A.K. - Original Message - From: David Winsemius To: noobmin Cc: r-help@r-project.org Sent: Tuesday, October 23, 2012 8:45 PM Subject: Re: [R] How to use tapply with more than one variables grouped On Oct 23, 2012, at 1:25 PM, noobmin wrote: >            AL  AR  CA  NY &

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 1:25 PM, noobmin wrote: > AL AR CA NY > Doug250 250 250 NA > Jennifer 20 340 300 100 > Michele 250 500 250 60 > Obama15 45 520 600 > > My English is not very good, I'll try again. I want to list ALL states in > the country where Obama had grea

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Y.Obama   #   520  600 A.K. - Original Message - From: noobmin To: r-help@r-project.org Cc: Sent: Tuesday, October 23, 2012 3:00 PM Subject: Re: [R] How to use tapply with more than one variables grouped I meant where obama has higher value compared to other candidates. Looking at the

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread Bert Gunter
You're posting on Nabble, so we don't see earlier messages in the thread here. -- Bert On Tue, Oct 23, 2012 at 11:36 AM, noobmin wrote: > The criteria is to list where Obama has a higher number of contributions. The > table shows the number of contribution that each presidential candidate > rece

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
#Contribution for Obama res1[grep("Obama",names(res1))] #Obama_CA Obama_NY   #   520  600 A.K. - Original Message - From: noobmin To: r-help@r-project.org Cc: Sent: Tuesday, October 23, 2012 12:48 PM Subject: Re: [R] How to use tapply with more than one variables grouped To

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
I meant where obama has higher value compared to other candidates. Looking at the column NY, Obama has the highest. So to state that he wins. Looking for AR column, Michelle wins. I JUST want to list where obama wins. Thank you! This seems to work, just do not understand why you used a threshold?

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
Thank you! This seems to work, just do not understand why you used a threshold? I will study your solution, thanks again! -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-tapply-with-more-than-one-variables-grouped-tp4646948p4647199.html Sent from the R help mailing li

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
The criteria is to list where Obama has a higher number of contributions. The table shows the number of contribution that each presidential candidate received in a state of the country. The table shown is an example, the query should be generic to a database with hundreds of candidates and dozens

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
    520    600 res1[grep("Obama",names(res1))] #amount received for Obama #Obama.CA Obama.NY   #   520  600  length(res1[grep("Obama",names(res1))]) #[1] 2 A.K. - Original Message - From: noobmin To: r-help@r-project.org Cc: Sent: Tuesday, October

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
To take this example I reduced the number of records absurdly. In the original database there are 48 000 candidates and dozens of states. There is no way to analyze data visually. I would not put 400 mb of tables here. But based on the example how could list the states where obama received more con

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
o: r-help@r-project.org Cc: Sent: Tuesday, October 23, 2012 7:41 AM Subject: Re: [R] How to use tapply with more than one variables grouped I believe that previously could not be understood. To facilitate'll give you an example. Assuming my table is presented below with the amount received from ea

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread PIKAL Petr
Hi and what is wrong? Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of noobmin > Sent: Tuesday, October 23, 2012 2:52 PM > To: r-help@r-project.org > Subject: Re: [R] How to use tapply with more

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
I believe that previously could not be understood. To facilitate'll give you an example. Assuming my table is presented below with the amount received from each candidate for president in a particular country state. AL AR CA NY Doug 250 250 250 NA Jennifer 20 340 300 1

Re: [R] How to use tapply with more than one variables grouped

2012-10-22 Thread PIKAL Petr
Hi > -Original Message- > From: Bert Gunter [mailto:gunter.ber...@gene.com] > Sent: Monday, October 22, 2012 4:00 PM > To: PIKAL Petr > Cc: noobmin; r-help@r-project.org > Subject: Re: [R] How to use tapply with more than one variables grouped > > Inline. >

Re: [R] How to use tapply with more than one variables grouped

2012-10-22 Thread Bert Gunter
-project.org >> Subject: Re: [R] How to use tapply with more than one variables grouped >> >> interTable <-data.frame (Tapply ($ contb_receipt_amt date, list ($ >> cand_nm date, $ contbr_st date), sum)) >> >> I got create a table with the sum total contri

Re: [R] How to use tapply with more than one variables grouped

2012-10-22 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of noobmin > Sent: Monday, October 22, 2012 12:31 PM > To: r-help@r-project.org > Subject: Re: [R] How to use tapply with more than one variables group

Re: [R] How to use tapply with more than one variables grouped

2012-10-22 Thread noobmin
interTable <-data.frame (Tapply ($ contb_receipt_amt date, list ($ cand_nm date, $ contbr_st date), sum)) I got create a table with the sum total contribution (contb_receipt_amt) of each presidential candidate (cand_nm) in each state (contbr_st). How could from interTable create a table of states

Re: [R] How to use tapply with more than one variables grouped

2012-10-22 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of noobmin > Sent: Monday, October 22, 2012 2:28 AM > To: r-help@r-project.org > Subject: [R] How to use tapply with more than one variables grouped > >

[R] How to use tapply with more than one variables grouped

2012-10-21 Thread noobmin
I'm studying alone the R language for data preparation. I found a course at MIT for data preparation that uses python but I'm using R to learning. The first exercise is the preparation of data from a database that shows the contributions made to candidates for U.S. president. The database is descri