Skip to content

Commit 2ff076a

Browse files
committed
small update
1 parent 50e58ed commit 2ff076a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

solutions/solution4A.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ nrow(diabetes_glucose)
189189
```
190190

191191

192-
9. Add the list as a column in the `diabetes_glucose` data frame.
192+
9. Add the list as a new column in the `diabetes_glucose` data frame. Note: Before assigning it, use the `unlist()` function to convert the list to a flat vector. This ensures that each value aligns correctly with the rows of the data frame.
193193

194194
```{r}
195-
diabetes_glucose$risk_status <- risk_status
195+
diabetes_glucose$risk_status <- unlist(risk_status)
196196
```
197197

198198
```{r}
199-
diabetes_glucose %>% select(BMI, Smoker, risk_status) %>% unnest(risk_status)
199+
diabetes_glucose %>% select(BMI, Smoker, risk_status)
200200
```
201201

202202
10. Make a list of all the column names in `diabetes_glucose` that contain categorical variables. Make a for loop that goes through the list and prints a barplot for each of the categorical variables.

0 commit comments

Comments
 (0)