saving . . . saved str and levels command has been deleted. str and levels command has been hidden .
str and levels command
Title
Question
On applying the following commands -
str(movies$mpaa_rating)
level(movies$mpaa_rating)
the output is not showing levels-

> str(movies$mpaa_rating)
 chr [1:600] "R" "PG-13" "R" "PG" "R" "Unrated" "PG-13" "R" "Unrated" "Unrated" "PG" ...
> levels(movies$mpaa_rating)
NULL

R Aesthetic-Mapping-in-ggplot2 04-05 min 40-50 sec 10-12-20, 8:39 p.m. Joohi

Answers:

Ideally, it should show the levels of the column, as given below:

> str(movies$mpaa_rating)
 Factor w/ 6 levels "G","NC-17","PG",..: 5 4 5 3 5 6 4 5 6 6 ...
> levels(movies$mpaa_rating)
[1] "G"       "NC-17"   "PG"      "PG-13"   "R"       "Unrated"

11-12-20, 12:52 a.m. sudhakarst


Why it is giving different output then ?
14-12-20, 4:51 p.m. Joohi


Log-in to answer to this question.