Skip to content
Alathea edited this page Jul 11, 2014 · 7 revisions

Ask and answer questions!

Data Structures

  • What's the difference between levels(f1) <- rev(levels(f1)) and factor(letters, levels=rev(letters))? The help says "Note that for a factor, replacing the levels via levels(x) <- value is not the same as (and is preferred to) attr(x, "levels") <- value." I don't understand why the first one actually modifies the factor and the other only acts on the levels.

Clone this wiki locally