laderast/r-bootcamp

Comments on Module 1 - From Gabby Choonoo

Closed this issue · 1 comments

Structure by Ted laderas, PhD

Module1.R – the actual module script to be loaded into an IDE such as Rstudio
module1.Rdata – sample workspace
mouseData.txt – sample tab delimited file for loading
testScript.R – sample script used in module 1
module1-test-your-knowledge.R – sample test your knowledge quiz
myFirstScript.R – Fill in the blank script for final project

Comments for module1.R

Line 22 Maybe add links to your other suggested texts (Intro stats using R/R Cookbook)

Line 28 Explain how it's not best practice to change directories within a script for reproducibility issues and that's why it's important to have all correct files in one directory for associated scripts

Line 35 Might help to see this example to further observe the directory, add list.files("./Module1-loading-saving") and explain use of "./" for directories

Line 39 Need to mention difference in syntax for mac vs pc

Line 43 You have load workspace, need to add saving the workspace so if they don't finish Module 1 in one sitting they can back to later

Line 46 List what should be saved in the workspace when they load it. Explain how data 'iris' is a dataset saved within R and how/where to access other data sets

Line 55 Ask them to observe 'testObject' before you have them remove it (class/length/value) so they know what they're doing

Line 59 Comment out rm(list=ls()) to avoid erasing data if they source script and also so they can refer back to the iris data set to make comparisons to mouseData

Line 73 Explain difference between "=" and "<-"

Line 82 Short hand parameters within functions is helpful information, but you might want to add that it's not recommended to short hand until they have memorized function arguments. Could expand on human readability (line 85) because as they are learning R they will need to refer back to their code and know what parameters they have set

Line 104 They've already been exposed to the term 'data frame' at this point, you can add that mouseData is the same class as iris
class(iris) == class(mouseData)

Line 124 Take this out, you have two part 2 headers

Line 133 Could add question about indexing columns

Line 132 Could add a question about what happens when you add skip=1 when you load mouseData

Line 134 Explain what to do/how to interpret NA's and duplicated rows, possible reasons for them, and how to remove them

Line 141 Could also add dim(mouseData) to understand structure of data

Line 150 Could explain how to subset the data based on 1 or more features (example: mouseData[which(mouseData$Strain=="B6"),] and save as a new data frame)

Line 155 Could explain how you can copy and paste the plot straight into word and sometimes the quality is better than when saved as pdf or png

Line 176 Specify parameter x=mouseData to be consistent

Line 190 You could add something in the testScript.R that would throw back a little error and explain how to fix it and re-run, include simple debugging strategies since they need to know this when writing their first script. Explain best practices in sourcing scripts properly (clear workspace, set correct working directory, source, make sure there are no errors and has correct output)

Comments for module1-test-your-knowledge.R

Suggestions for test questions:
What if you forgot the full name of your directory, how would you search for it in R?

What would be the best way to remove clutter from your workspace (example: wrong answers from question 2) what would be the best way to determine which objects need to be removed?

What is the correct direction for a given assignment in R when using “<-“? For “=””?

What if you get an error, should you consult the function definition, the line where the error occurred, google?

Comments for myFirstScript.R

Great job, I think this is a good start for students to learn R. Big issues students have when first learning R are things like organizing their working directory, knowing what's in their workspace, and handling errors.

Modified script to incorporate suggestions.