[R] ddply/tapply and set function

A. Mani @@m@n|@cm@ @end|ng |rom gm@||@com
Wed Feb 17 15:10:26 CET 2021


The original data frame can be like
Type   Id
1         1
1         5
1         7
2         3
2         8
..        ....

tapply(Id,Type,set) will yield the sets correctly (assuming the data
frame is attached) but not a data frame of the form mentioned.

A similar ddply command does not work at all with the function 'set'
(while 'mean' etc work fine)

Thanks and Best

A Mani

Prof.Dr.(Miss) A Mani
ASL, AMS, ISRS, CLC, CMS, MTA
Senior Member, International Rough Set Society
Research Scientist, Indian Statistical Institute, Kolkata
Formerly HBCSE, TIFR, CU.
Homepage: https://www.logicamani.in
Blog: https://logicamani.blogspot.in/
Research Gate: https://www.researchgate.net/profile/Mani_A
sip:girlprofessor using ekiga.net
Pronouns: She/Her/Hers

On Wed, Feb 17, 2021 at 4:24 PM Jim Lemon <drjimlemon using gmail.com> wrote:
>
> Hi  A,
> I'm unable to work out what you are using as input. Maybe:
>
> id<-data.frame(Type=c(1,2,1,1,2),set=c(1,3,5,7,8))
>
> but that doesn't work with your
>
> tapply(id,Type,set)
>
> command. Perhaps a bit more detail?
>
> Jim
>
>
>
> On Wed, Feb 17, 2021 at 7:48 PM A. Mani <a.mani.cms using gmail.com> wrote:
> >
> > I want a data frame (derived from another data frame) of the form
> >
> > Type   Set
> > 1         {1,5, 7}
> > 2         {3,8)
> > ..        ....
> >
> > tapply(Id,Type, set) works, but does not yield a data frame.
> > 'set' is from package set/set6/etc
> > ddply does not seem to work with the function.
> > How should I proceed with this optimally?
> >
> >
> > Thanks and Best
> >
> > A Mani
> >
> > Prof.Dr.(Miss) A Mani
> > ASL, AMS, ISRS, CLC, CMS, MTA
> > Senior Member, International Rough Set Society
> > Research Scientist, Indian Statistical Institute, Kolkata
> > Formerly HBCSE, TIFR, CU.
> > Homepage: https://www.logicamani.in
> > Blog: https://logicamani.blogspot.in/
> > Research Gate: https://www.researchgate.net/profile/Mani_A
> > sip:girlprofessor using ekiga.net
> > Pronouns: She/Her/Hers
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.



More information about the R-help mailing list