saving . . . saved NULL on levels(movies$mpaa_rating) has been deleted. NULL on levels(movies$mpaa_rating) has been hidden .
NULL on levels(movies$mpaa_rating)
Title
Question
levels(movies$mpaa_rating) - on executing this statement getting as:-
str(movies$mpaa_rating)
 chr [1:600] "R" "PG-13" "R" "PG" "R" "Unrated" "PG-13" "R" ...
> levels(movies$mpaa_rating)
NULL
Please let me know what to do correction

R Aesthetic-Mapping-in-ggplot2 00-01 min 0-10 sec 15-05-20, 1:46 p.m. varshapalatse@gmail.com

Answers:

We tried running the commands as shown below and got the output: 
------------------------------------------------------------------------------------------------
> 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"
-----------------------------------------------------------------------------------------------
Please ensure that you have loaded the dataset in the environment. 
15-05-20, 3:58 p.m. sudhakarst
It shows the same for me as well. After running the command the level is been displayed NULL.
.
10-08-20, 7:46 p.m. ASHABAREE
It shows the same for me as well. So what I did is that I intentionally converted them into factors .
> # To convert into factors/categorical data
> movies$mpaa_rating <-  factor(movies$mpaa_rating)
> 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"
16-10-20, 4:05 p.m. DVB

Login to add comment


Log-in to answer to this question.