Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmyleswhite/af220de4ab2e48c3f890 to your computer and use it in GitHub Desktop.
Save johnmyleswhite/af220de4ab2e48c3f890 to your computer and use it in GitHub Desktop.
Factor arithmetic
> x <- 1
> f <- factor(x)
> f[1] * f[1]
[1] NA
Warning message:
In Ops.factor(f[1], f[1]) : * not meaningful for factors
> p <- f[1] * f[1]
Warning message:
In Ops.factor(f[1], f[1]) : * not meaningful for factors
> class(p)
[1] "logical"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment