Code Monkey home page Code Monkey logo

Comments (3)

matloff avatar matloff commented on August 25, 2024

Thanks for the valuable comments! Most are spot on, and I will correct the problems. I do differ with you on two points. First, AFAIK no one considers an R factor to be an S3 object. Second, regarding the 'mtcars' dataset, the name alludes to the fact that the data comes from Motor Trend, a popular American car magazine in the 1960s/70s; the weights are almost certainly in pounds, just like the gas mileage is in miles/gallon rather than say km/liter.

from faster.

ReeceGoding avatar ReeceGoding commented on August 25, 2024

Addressing your points:

  1. In my experience, people do consider factors to be S3 objects. This is exactly why a lot of R tutorials warn about how they sometimes act like integers and sometimes act like characters. A well-known example is section 8.2. of the R Inferno. The documentation for factors also contains many such warnings. Regardless, whether or not factors are S3 objects is not a matter of opinion. Run methods(class=factor) and you will see many generic functions that dispatch to them.
  2. According to ??datasets::mtcars, the wt variable is "Weight (1000 lbs)". I think we're both right here. Yes, they're pounds, but the reader ought to be told that adding 100 pounds means adding 0.1.

from faster.

matloff avatar matloff commented on August 25, 2024

R factors can be both very powerful and highly annoying. In my 'regtools' package (here on GitHub), I actually have 5 or 6 utilities to deal with problems arising with factors. But I've never heard anyone consider factors to be S3. I've been active in R since almost the beginning (and was an S user before R), have served in editorial capacity with 2 R-related journals etc.

from faster.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.