Im working on a project regarding information about movies including their release date.
My professor wants us to add a new column reflecting the decade the movies were released in (1980s, 1990s, 2000s, or 2010s). In the original spreadsheet, we have a "Release" column in the format %Y-%m-%d. I have already changed it from a factor to date using the command:
df$Release<-as.Date(df$Release, format = "%Y-%m-%d")
Now, again, he wants a new column with just the decade as stated earlier. This is where I hit a wall. We have not learned much in this class, so I attempted to do so using an if statement like so:
if(df$Release == "198"){
df$Decade<- "1980s"
}
While I'm aware this is wrong (I assume that its too specific) that was the idea I had. I have not learned enough to really do much else!
Here is a snapshot I took of my df so it may make more sense for you all
Thanks for any help!
Aucun commentaire:
Enregistrer un commentaire