Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi how do I create tibble named `body` as using `mutate` of `bdims` in which I change variable `sex` to a factor with use of
Hi how do I create tibble named `body` as using `mutate` of `bdims` in which I change variable `sex` to a factor with use of `factor()` with `levels = c(0, 1)`, and recode the factor levels of `sex` to `f` and `m` instead of `0` and `1` using fct_recode().
This is what I've tried, but does not work as intended.
body <- tibble( mutate(bdims, factor(sex, levels = c(0, 1)), fct_recode(bdims$sex, f = "0", m = "1")) )
running packages:
library(tidyverse) library(openintro) library(broom) library(lubridate) library(janitor)
Thanks in advance.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started