[R] Count unchanged class attribute

Bert Gunter gunter.berton at gene.com
Wed May 20 05:04:58 CEST 2015


Probably "or what."

This demonstrates a fundamental conundrum: many users or prospective users
of R have had little exposure to data structures in their formal education
and therefore can be flummoxed by R's fussiness -- as any programming
language must necessarily be. Consider: data frames, matrices, lists,
"classes", objects with attributes (e.g. factors),...

Excel, which is basically structureless, of course, exacerbates the
problem. Those accustomed to its tolerance (and the confusion that results)
expect R to behave the same way. Education is the only recourse, either in
formal courses or through R tutorials that strongly emphasize this aspect
of interacting with R and especially writing effective code. But that
demands effort and, to some extent, aptitude... both of which seem to be in
increasingly short supply amidst the worldwide explosion in R's usage.

Of course, feel free to disagree... Just my $.02

Cheers,
Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom."
Clifford Stoll



On Tue, May 19, 2015 at 7:02 PM, John Kane <jrkrideau at inbox.com> wrote:

> Is this a list of data.frames or what?
>
> Please have a look at one or both of these for some ideas of how to ask a
> question and provide information on the problem.  The better you can
> describe what you have and what you need the better people can help.
>
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> and http://adv-r.had.co.nz/Reproducibility.html
>
>
> John Kane
> Kingston ON Canada
>
>
> > -----Original Message-----
> > From: soe.xiyan at gmail.com
> > Sent: Tue, 19 May 2015 23:37:13 +0700
> > To: r-help at r-project.org
> > Subject: [R] Count unchanged class attribute
> >
> > Maybe someone can help me.
> > Suppose I have data-set like this:
> >
> >   Netto   Bruto  class
> > 1 10      1000    yes
> > 2 100     20      yes
> >
> >
> >   Netto   Bruto  class
> > 1 101     1000    yes
> > 2 100     210     no
> >
> >
> >   Netto   Bruto  class
> > 1 10      10      yes
> > 2 12      28      yes
> > 3 100     20      yes
> >
> >   Netto   Bruto  class
> > 1 120     200     no
> > 2 400     20      yes
> >
> >
> >   Netto   Bruto  class
> > 1 110     12000   yes
> > 2 1100    120     yes
> > 3 120     100     yes
> > 4 1140    125     yes
> >
> > How to calculate the number of classes has changed.
> > The expected result is
> > - class changed    2
> > - class unchanged  3
> >
> >
> > Thank you so much.
> > Soe Xiyan
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at 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.
>
> ____________________________________________________________
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
>
> ______________________________________________
> R-help at 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list