Open CassKon opened 6 years ago
Dear @CassKon,
Interesting homework 5, I like that you tried something new and a bit out of the box !
Singer version Factorise: task successfully completed ! Just for your information, in this section, you wrote this code stating that you used forcats:
singerData <- singerData %>%
mutate( artist_name = factor(singerData$artist_name), year = factor(singerData$year))
but factor() is actually a function of Base R. Forcats uses as_factor. If you type the following in R, you will find more information about the subtle differences between base R and forcats to change a variable to factors:
?factor
?as.factor
?as_factor
# or you can specify the package if as_factor is part of more than one packages as follow:
?forcats::as_factor
Singer version: drop 0: task successfully completed ! The nlevels() function provides the count of levels, but unlike levels(), it can not be used to change the attribute of a factor variable. For example, this would provide the same result as you obtained with levels():
nlevels(singerData$artist_name)
Reorder the levels of year, artist_name or title: task successfully completed. Just a little tip, in your code, you don't have to use the arrange() function since you have re-ordered your year factors according to the mean_hotness already.
File I/O: task successfully completed. I really liked your comments on your experience of write.csv/read.csv and saveRDS/readRDS. As you accurately pointed, the read.csv() function interprete year as an integer, while readRDS() inteprete year as a factor, which you can see with this function:
sapply(singerData_csv, class)
sapply(singerData_rds, class)
Also, read.csv adds a column called "X" which is the row number, which I could not find out how to remove (mysterious), tricky !
Visualization design: task successfully completed! I really like the world map you created, it is aesthetically pleasing and easy to read.
Save a plot to file and call it back: You have the correct "general" code format in your raw Rmd file ![](/Users/cassandrakonecny/Desktop/STAT545A/lifeExp_Map.png)
but your plot does not appear on github because your plot is saved on your local computer and not in your repository and you are calling a local path with this function. Or perhaps another possible explanation is that your forfot to commit the png plot to your github? If the lifeExp_Map.png is in the same folder as your homework 5 Rmd file, you could try directly: ![](lifeExp_Map.png)
Document your process: you completed this task successfully as well, but I would encourage you to put as much detail as you can about your process in your homework and even some references, because you will find it very useful in the future when you read back your homework and try to troubleshoot some issues with you data :)
Clean up your repo: You repository is very tidy, with each homework folder having an informative README file! Your top level README file also has links to individual homework, well done.
(1) I always try to run the code I review in STAT545 although it might have limited application in my field because it helps me to discover new functions and troubleshoot some unexpected issues. Interestingly I received an error message when trying to run this command:
gde_15 <- readOGR("~/Desktop/stat545-inclass/peer-reviews-tracking/TM_WORLD_BORDERS-0.3", layer = "TM_WORLD_BORDERS-0.3")
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open data source
gde_15 <- readOGR(dsn=path.expand("~/Desktop/stat545-inclass/peer-reviews-tracking/TM_WORLD_BORDERS-0.3"), layer = "TM_WORLD_BORDERS-0.3")
(2) When I ran the fortify function of ggplot2, it worked, but R warned me that this function would most likely be deprecated in the future and recommended to use the broom package instead. Therefore, I have included a blog link on how to use broom functions here in case you need this type of ploting for your research.
If you have any questions, please don't hesitate to let me know.
Warm regards, My Linh Thibodeau
Hi @ CassKon,
It’s nice to review your homework.
Your repo is organized. Your README.md files contain all useful links which make it easy to reach your homework. In addition, you clean up your repo and add content table in the main README.md.
You use singer dataset to complete the first three tasks. It’s great to use nlevels()
to show the change after your drop the levels of year. It would be more clear if you also check the number of levels between filter()
and fct_drop()
.
For reordering the levels of year, it would be better if you can show the head of levels of year by levels()
. arrange()
makes your output organized, but is not enough to show the result of reordering.
I really like to map you made. It’s really nice to learn how to do it.
Overall, I think you did a good job.
Hi @CassKon, here are some comments about your hw05:
Your grade will be emailed to you at a later date.
Cassandra Konecny hw05