Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

invinteraction

Split an interaction'ed factor back into seperate variables


Description

Inverse of interaction

Usage

invinteraction(fac, ..., sep = ".")

Arguments

fac

the factor to split

...

optional, names for variables

sep

the seperator between levels

Value

a data.frame of factors

Changes

Refactored to process the levels vector, rather than entire factor vector.

Author(s)

42, Neal Fultz

References

See Also

Examples

f1 <- gl(2, 3)
f2 <- gl(3, 2)
invinteraction(f1:f2, sep=':') 

ppl <- interaction(
  eyes = as.factor(sample(colors(), 10)),
  hair = as.factor(sample(colors(), 10))
  )
str(invinteraction(ppl, "eyes", "hair"))

stackoverflow

Stack Overflow's Greatest Hits

v0.7.0
CC BY-SA 4.0
Authors
Neal Fultz <nfultz@gmail.com> and the StackOverflow.com community
Initial release
2020-01-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.