In this repository you will find data describing Swirl activity from the class so far this semester. Please connect RStudio to this repository.
- Open a new R Markdown file, please write and run all your commands from within the R Markdown document
- Delete the contents of the Markdown file and insert a new code block
- Load the libraries
tidyr
anddplyr
- Create a data frame from the
swirl-data.csv
file calledDF1
The variables are:
course_name
- the name of the R course the student attempted
lesson_name
- the lesson name
question_number
- the question number attempted
correct
- whether the question was answered correctly
attempt
- how many times the student attempted the question
skipped
- whether the student skipped the question
datetime
- the date and time the student attempted the question
hash
- anonymyzed student ID
-
Create a new data frame that only includes the variables
hash
,lesson_name
andattempt
calledDF2
-
Use the
group_by
function to create a data frame that sums all the attempts for eachhash
by eachlesson_name
calledDF3
-
On a scrap piece of paper draw what you think
DF3
would look like if all the lesson names were column names -
Convert
DF3
to this format -
Create a new data frame from
DF1
calledDF4
that only includes the variableshash
,lesson_name
andcorrect
-
Convert the
correct
variable so thatTRUE
is coded as the number1
andFALSE
is coded as0
-
Create a new data frame called
DF5
that provides a mean score for each student on each course -
Extra credit Convert the
datetime
variable into month-day-year format and create a new data frame (DF6
) that shows the average correct for each day