alan-turing-institute / r-from-scratch

LearnR tutorial, and scripts to deploy on the cloud.
MIT License
1 stars 1 forks source link

Learn R course upload #2

Closed sgibson91 closed 5 years ago

sgibson91 commented 5 years ago

File Upload

I have copied Matthew Brett's R from Scratch course (from this repo) into LearnR-course.Rmd file and altered run.R to point to this new file. Hence executing shiny.sh will launch the new course, not the original tutorial in LearnR.Rmd.

Issue with SCT in final exercise of Chapter 2 has been fixed by using check_result() %>% check_equal() which allows for the answers head(gender_data) and head(gender_data, 6) (same for tail) and marks the answer as incorrect for displaying more/fewer lines of the table.

will fix #3

matthew-brett commented 5 years ago

Hi,

I did use regular expressions a bit too much to check output. As I got better at the testing interface, I started to use these kinds of checks instead:

state <- ex() check_function(state, "head") %>% check_arg("x") %>% check_equal()

Maybe replace there too?

Cheers,

Matthew

On Fri, Nov 9, 2018 at 3:52 PM martintoreilly notifications@github.com wrote:

@martintoreilly commented on this pull request.

In LearnR-course.Rmd https://github.com/alan-turing-institute/r-from-scratch/pull/2#discussion_r232300059 :

state <- ex() check_function(state, "head") %>% check_arg("x") %>% check_equal()

-# This section of the code check gives an incorrect answer to the head section. -#check_output(state, -# '1 Afghanistan 4\.95450 19961015094[[:space:]]+ 161\.1380', -# missing_msg='Did you display the value for "head(gender_data)"?')

-# This gives a correct answer, but adding more to the regex arg causes an incorrect message. -check_output(state,

  • 'Afghanistan',
  • missing_msg='Did you display the value for "head(gender_data)"?')
  • +ex() %>% check_function("tail") %>% check_result() %>% check_equal()

This looks good. It would be nice if we had a test that validates this throws an error if the user provides head() with an explicit number of records that isn't 6. However, as hooking into the inside of LearnR seems tricky, I think we'll live with you having manually verified this.

Please could you capture this learning in an issue, describing the original problem and (i) the solution and (ii) the things that looked like they might have worked but didn't.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alan-turing-institute/r-from-scratch/pull/2#pullrequestreview-173471109, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEIHKHFJ0dt-LM9bLqkcT2CcL45kNQ3ks5utaTEgaJpZM4YWcKs .

sgibson91 commented 5 years ago

I'm closing this pull request as I'll be filing a new one with a new package. The course file that would have been uploaded in this pull request will be contained inside the package.