About 9,890,000 results
Open links in new tab
  1. Why use as.factor () instead of just factor () - Stack Overflow

    Expanded answer two years later, including the following: What does the manual say? Performance: as.factor > factor when input is a factor Performance: as.factor > factor when input is integer Unused …

  2. r - Changing factor levels with dplyr mutate - Stack Overflow

    Jan 28, 2015 · 19 From my understanding, the currently accepted answer only changes the order of the factor levels, not the actual labels (i.e., how the levels of the factor are called). To illustrate the …

  3. Convert existing dataframe variable to factor in Tidyverse

    Feb 26, 2022 · When you have an existing character variable in a dataframe, is there an easy method for converting that variable to a factor using the tidyverse format? For example, the 2nd line of code …

  4. How to reorder factor levels in a tidy way? - Stack Overflow

    Jul 17, 2017 · A couple comments: reordering a factor is modifying a data column. The dplyr command to modify a data column is mutate. All arrange does is re-order rows, this has no effect on the levels …

  5. Convert data.frame column format from character to factor

    Dec 6, 2018 · The complete conversion of every character variable to factor usually happens when reading in data, e.g., with stringsAsFactors = TRUE, but this is useful when say, you've read data in …

  6. r - summarizing counts of a factor with dplyr - Stack Overflow

    Sep 12, 2014 · I want to group a data frame by a column (owner) and output a new data frame that has counts of each type of a factor at each observation. The real data frame is fairly large, and there are …

  7. How to force R to use a specified factor level as reference in a ...

    You should do the data processing step outside of the model formula/fitting. When creating the factor from b you can specify the ordering of the levels using factor(b, levels = c(3,1,2,4,5)). Do this in a …

  8. r - list all factor levels of a data.frame - Stack Overflow

    Dec 28, 2014 · with dplyr::glimpse(data) I get more values, but no infos about number/values of factor-levels. Is there an automatic way to get all level informations of all factor vars in a data.frame?

  9. Filter factor levels in R using dplyr - Stack Overflow

    May 5, 2015 · Filter factor levels in R using dplyr Asked 10 years, 6 months ago Modified 10 years, 6 months ago Viewed 67k times

  10. Convert all data frame character columns to factors

    Given a (pre-existing) data frame that has columns of various types, what is the simplest way to convert all its character columns to factors, without affecting any columns of other types? Here's an