swirldev / swirlify Goto Github PK
View Code? Open in Web Editor NEW:books: A toolbox for writing swirl courses
License: Other
:books: A toolbox for writing swirl courses
License: Other
E.g. cmd_question Use ?iris to read more about the iris data set.
This should be handled gracefully.
I will try to do a pull request.
Dear maintainers,
Thanks for your work of swirlify. I am using swirlify
to develop our swirl course and this is great. However, I guess the swirlify::testit
does not automatically check if CorrectAnswer
passes the tests in AnswerTests
.
ChihChengLiang and I develop a test script which scans the lesson.yaml
and tests if all CorrectAnswer
passes the AnswerTests
. Based on this test, I build up a
CI system (Based on Appveyor and Travis-CI) to check the syntax of the lesson.yaml
and validate if the answers are correct or not. I think this feature is very useful to develop a swirl course.
Could we send a PR to let swirlify has a function to automatically test all answers?
Best,
Wush
Hi! I'm demo-ing a lesson I prepared in swirlify and I keep getting an error that has to do with escaping characters within regex. In R a double backslash needs to be used for that (for instance "\." forces the literal interpretation of the dot. In the code I'm using, that works perfectly outside of swirlify, but once I run it as an answer I get:
Error: '.' is an unrecognized escape in character string starting ""."
| Leaving swirl now. Type swirl() to resume.
This is weird because I'm typing the backslash twice. I'm running this in a tidyverse function and I think this somehow interferes, because I tried using on of the questions of the swirl course "Regular Expressions" and that run smoothly.
This is the code I'm using:
As mentioned, the code in CorrectAnswer works perfectly fine outside swirlify. Other versions of the same line that do not contain escaping backslashes also work ok.
I'm using swirlify 0.5.3 in R 4.0.2 under macOS Catalina 10.15.6. Thanks a lot!
> install_course_github('kdaily', 'Synapse', multi=TRUE)
Error in unzip(path, list = TRUE) :
zip file '/home/kdaily/R/x86_64-redhat-linux-gnu-library/3.1/swirl/Courses/temp.zip' cannot be opened
Installing from that zip does not work:
> install_course_zip("/home/kdaily/R/x86_64-redhat-linux-gnu-library/3.1/swirl/Courses/temp.zip")
Warning message:
In unzip(path, exdir = file.path(system.file(package = "swirl"), :
error 1 in extracting from zip file
Downloading as zip (https://github.com/kdaily/SwirlSynapse/archive/master.zip) and installing works:
> install_course_zip("~/src/SwirlSynapse-master.zip")
>
| Please choose a course, or type 0 to exit swirl.
1: Getting and Cleaning Data
2: Statistical Inference
3: SwirlSynapse-master
4: Synapse
5: Take me to the swirl course repository!
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] synapseClient_1.5-4 swirlify_0.3.0.99 swirl_2.2.21
loaded via a namespace (and not attached):
[1] digest_0.6.4 htmltools_0.2.6 httpuv_1.3.0 httr_0.5 mime_0.2 R6_2.0 Rcpp_0.11.3 RCurl_1.95-4.3
[9] RJSONIO_1.3-0 shiny_0.10.2.1 shinyAce_0.1.0 stringr_0.6.2 testthat_0.9.1 tools_3.1.2 whisker_0.3-2 xtable_1.7-4
[17] yaml_2.1.13
The conversion from lesson to rmd does not create the appropriate library() commands. I guess one could say to just use name spacing but although I do teach that as part of my course, it isn't in the earlier lessons and it would just be cleaner to handle it.
Hi,
I've just written my first swirl course and I think it's really great!
Also, I've now discovered lesson_to_html, and that's really useful to avoid duplicating content...
It would be even more useful if it included the correct answers and their outputs (including plots).
Would it be possible to add that?
Thx!
set_lesson()
#46 -- is there another way we can have lessons found or specified? The interactivity of set_lesson() is not easy to use.initLesson.R
, customTests.R
, dependson.txt
The below error happened for me when launching swirlify. The shiny UI still partially worked in that I could edit the description, but the colors went wonky and I was unable to add a new question (selecting the question type or clicking any of the buttons didn't do anything). Screenshot below error.
R> library(swirlify)
R> swirlify("Subsetting data with data.table", "data.table")
Creating lesson directory:
/usr/local/google/home/mghenis/data.table/Subsetting_data_with_data.table
Loading required package: shiny
Listening on http://127.0.0.1:3474
Shiny URLs starting with /shinyAce will mapped to /usr/local/google/home/mghenis/R/x86_64-pc-linux-gnu-library/3.0/shinyAce/www
Error in FUN(X[[2L]], ...) :
No method for converting htmlcharacter to JSON
When using R in Ubuntu Terminal, I get the below error messages. I'm in an organization where RStudio costs money, hence not using RStudio now.
R> library(devtools)
Loading required package: memoise
Loading required package: digest
Loading required package: httr
Loading required package: RCurl
Loading required package: bitops
Loading required package: evaluate
Loading required package: whisker
R> devtools::install_github("swirldev/swirlify")
Installing github repo(s) swirldev/swirlify/master from hadley
Downloading swirldev/swirlify.zip from https://github.com/hadley/swirldev/swirlify/archive/master.zip
Error: client error: (404) Not Found
Hi Sean,
I see that in most of the install functions file.rename() is used instead of file.copy(). This means that the existing course needs to be uninstalled before installing an updated version (if an update option was added). Admittedly you would also have to do file.remove to clean up the first unzipped copy but for me, as I'm adding lessons to the server, it would be preferable not to have to uninstall. If you agree, I'd be happy to send a PR for this change.
My course now runs for a few weeks and everything works fine. There is just
one thing which sometimes leads to complications. Every two weeks, I upload
a new lecture to my course. To make it available to the students, they have
to uninstall and reinstall the course using
uninstall_course("Statistics") # this is the name of my course
install_course_github("mertensu","Statistics")
But sometimes, I absolutely don't know why, the course gets installed under
a different name (instead of the name "Statistics"). Most of the time
something like this:
mertensu-Statistics-e87451b
--> the numbers in the end (here: e87451b) are just an example
This, as you can imagine, leads to problems. The students run the two lines
of the code above but the uninstall command gives an error since the course name
is not "Statistics". It is hard for me to tell them what to do in this case
via mail. Clearly, it is not difficult to figure out the name of the course
but it is additional work and they are completely new to using a programming
language/R.
It would therefore be great if the name of the course would always be
"Statistics" as it should be. Do you have any ideas what my cause the name
of the course to be different. Unfortunately, I can't reproduce the problem,
it seems to happen randomly. All I can say is that it happens quite frequently.
Hi,
In multiple choice answers, using a reserved word in an answer makes the testit() crash with a not helpful message (at least for me).
I can see that you are in the midst of redoing the testing and testit() is deprecated so I'm a bit hesitant to send a PR, but will try to solve if you want me to. It's a bit of a tricky issue because really something that happens in Swirl not Swirlify, but I feel as though Swirlify should catch it more gracefully if possible.
added: Maybe I should submit something about this to the swirl course gotcha lesson?
Would it be possible to explore the inclusion of a variant of the standard multiple choice question type in swirl which allows for a combination of values for the correct answer? This can be a more powerful way of questioning understanding and I think it would be a useful addition.
e.g. Which of the below countries are located in the southern hemisphere?
ANS: 1,3,4
I realize that the same kind of thing can be achieved by using different lists for the individual answer options e.g. (1. Australia, Mexico, Brazil 2. Mexico, Brazil, Botswana 3. Australia, Brazil, Botswana etc) but that approach starts to become less feasible/practical when each individual answer option is a more lengthy expression or command.
Example: "something"
gets converted (as I'm typing) to “something”
.
R doesn't recognize the rich text quotes. How do I suppress this behavior in the textarea
? Is it a bootstrap thing?
Wouldn't it be (at least potentially) valuable to have a formal way of versioning swirl courses (akin to package versioning etc) so that problems identified with course content can be isolated to particular versions of swirl course content in the case of students finding issues? I haven't seen a reference to this kind of thing anywhere in the documentation, so I assume it doesn't exist yet and I think it is worth considering.
Incorporating course versioning formally would of course involve updates to swirl itself rather than just to swirlify but since the motivation for the feature would be driven more from the instructor side I figured it would be more relevant to post it as an issue/potential enhancement here.
After running test_course(), the current lesson will be the last lesson specified in the manifest file, regardless of what the current lesson was before test_course() was called. This is fine for the general use case, but technically is an unexpected and unwanted "side effect".
testit()
demo_lesson()
is run.google_form_decode()
handles bad input gracefully.google_form_decode()
closes connections appropriately.Has the possibility of providing multiple hints been considered? i.e. allow course authors to provide multiple hints and show one at random each time a question is answered incorrectly?
testit()
to demo_lesson()
in swirlfile.edit()
testit()
will be deprecated in swirlify 0.6testit()
with regard to reading the MANIFESTadd_to_manifest()
so that a space does not appear after the lesson nameswirlify()
just work with regard to switching from one lesson to another in the same course.google_form_decode()
See this conversation: https://github.com/datatrail-jhu/datatrail-swirl/pull/13/files#r954106837
It wasn't clear to me looking at the set_lesson()
function documentation that I would only need to send it to one of the lesson.yaml's in order for all lessons to be included.
I'll file a PR with some changes later.
testit()
| Course installed successfully!
| | 0%
Error in gzfile(file, mode) : cannot open the connection
| Leaving swirl now. Type swirl() to resume.
sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] swirlify_0.3.0.99 swirl_2.2.21 data.table_1.9.2
[4] qdap_2.0.0 RColorBrewer_1.0-5 qdapTools_1.0.3
[7] qdapDictionaries_1.0.2 ggplot2_0.9.3.1
loaded via a namespace (and not attached):
[1] assertthat_0.1 bitops_1.0-6 caTools_1.16
[4] chron_2.3-45 colorspace_1.2-4 devtools_1.4.1
[7] dichromat_2.0-0 digest_0.6.4 dplyr_0.2
[10] evaluate_0.5.1 gdata_2.13.2 grid_3.0.2
[13] gridExtra_0.9.1 gtable_0.1.2 gtools_3.3.1
[16] htmltools_0.2.6 httpuv_1.2.3 httr_0.2
[19] igraph_0.7.0 labeling_0.2 MASS_7.3-30
[22] memoise_0.1 munsell_0.4.2 NLP_0.1-1
[25] openNLP_0.2-2 openNLPdata_1.5.3-1 parallel_3.0.2
[28] plotrix_3.5-5 plyr_1.8.1 proto_0.3-10
[31] Rcpp_0.11.1 RCurl_1.95-4.1 reports_0.1.2
[34] reshape2_1.2.2 rJava_0.9-6 RJSONIO_1.3-0
[37] scales_0.2.3 shiny_0.10.1 shinyAce_0.1.0
[40] slam_0.1-31 stringr_0.6.2 testthat_0.8.1
[43] tm_0.5-10 tools_3.0.2 venneuler_1.1-0
[46] whisker_0.3-2 wordcloud_2.4 xlsx_0.5.5
[49] xlsxjars_0.6.0 XML_3.95-0.2 xtable_1.7-3
[52] yaml_2.1.13
System Version: OS X 10.10.1 (14B25)
Kernel Version: Darwin 14.0.0
Boot Volume: Macintosh HD
I have been writing some swirl lessons to use in my undergraduate biology course. I couldn't figure out how to do a script question on my own at all. I used the code for the customTests.R from the "Tidying Data with tidyr" lesson in the "Getting and Clearning Data" course. I honestly don't understand that code at all, but it works. I am able to use submit() to submit the script.R file and it gets compared to the script-correct.R file just fine. But when I try using reset() to start the script from scratch it gives an error like this
"Error in UseMethod("do_rst") :
no applicable method for 'do_rst' applied to an object of class "c('environment', 'test')"
| Leaving swirl now. Type swirl() to resume."
I just removed the option to use reset() from the instructions or hint in the question. So I have things working okay. But it would be nice for students to have the ability to use reset() to start a script for a script question over from scratch.
I am not at a very experienced programmer (I am an academic who knows how to just to code to do the analyses I need to visualize and analyze my data). I just learned how to use swirl and swirlify fairly recently. So I may be missing something very obvious here.
I am using swirl 2.4.4 and swirlify 0.5.3
I am trying to install a course but I get the following error: > install_course_zip("C:\Users\Owner\Desktop\14_310x_Intro_to_R.zip,multi=FALSE")
Warning message:
In unzip(path, exdir = swirl_courses_dir()) :
error 1 in extracting from zip file
The steps I have taken are the following:
install.packages(“swirl”)
library( )
library(“swirl”)
install_course_zip("C:\Users\Owner\Desktop\14_310x_Intro_to_R.zip,multi=FALSE")
The swirlify shiny app does not let me add any questions. When I launch the app with swirlify("My Lesson", "My Course") I can move through the drop down menu and go to the different tabs but when I click on the 'Add Question' action button nothing happens. In fact, none of the buttons (Select All, Select None, etc.) in the app seem to do anything. I'm working on a Windows machine and tried it with both the CRAN and the developer version of swirlify.
Hi,
I have lesson_to_html erroring out at an exact_question because there's no implementation for makemd:
(I get the error from makemd.default <- function(unit) {
stop("No unit class specified!", unit)
}
)
Would it be possible to add an implementation for exact_question, please?
thx!
test_course() doesn't seem to check for naming inconsistencies within the yaml of the different lesson files
testthat
Outputt
)swirlify_help()
demo_lesson()
crashes RStudio.Hi, I am a graduate student TA and I'm hoping to use swirl to teach my students R this fall. We'd really like to log their progress out of class, so I'm really appreciative of the built-in logging feature. I'm going to be using the base courses for swirl for my undergrads, but it seems that not all lessons have an initLesson.R to edit to enable logging.
Is there a quick way to insert this capability without breaking the functionality of lessons?
Best,
hey guys, i tried to do an install using:
devtools::install_github(c("swirldev/swirl", "swirldev/swirlify"))
at first it told me that htmltools couldn't be installed and so i download the tgz and installed locally. trying again, it doesn't give me any errors other than the last line saying that it was DONE but not quite hahaha but then it doesn't tell me what went wrong. Not sure what to do next, any thoughts? How can I install from a local file? Please see output below
devtools::install_github(c("swirldev/swirl", "swirldev/swirlify"))
Installing github repo swirl/master from swirldev
Downloading master.zip from https://github.com/swirldev/swirl/archive/master.zip
Installing package from /var/folders/pn/_9xy5vn97pdfg6q1t4h43lr00000gn/T//RtmpkrWTgb/master.zip
arguments 'minimized' and 'invisible' are for Windows only
Installing swirl
'/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD
INSTALL
'/private/var/folders/pn/_9xy5vn97pdfg6q1t4h43lr00000gn/T/RtmpkrWTgb/devtools17d2522697fa/swirl-master'
--library='/Library/Frameworks/R.framework/Versions/3.1/Resources/library'
--install-tests
- installing source package 'swirl' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded- DONE (swirl)
Reloading installed swirl
unloadNamespace("swirl") not successful. Forcing unload.
Installing github repo swirlify/master from swirldev
Downloading master.zip from https://github.com/swirldev/swirlify/archive/master.zip
Installing package from /var/folders/pn/_9xy5vn97pdfg6q1t4h43lr00000gn/T//RtmpkrWTgb/master.zip
arguments 'minimized' and 'invisible' are for Windows only
Installing swirlify
'/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD
INSTALL
'/private/var/folders/pn/_9xy5vn97pdfg6q1t4h43lr00000gn/T/RtmpkrWTgb/devtools17d263c3c838/swirlify-master'
--library='/Library/Frameworks/R.framework/Versions/3.1/Resources/library'
--install-tests- installing source package 'swirlify' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded- DONE (swirlify)
Reloading installed swirlify- installing source package 'swirl' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded- DONE (swirl)
- installing source package 'swirlify' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded- DONE (swirlify)
| Not quite, but you're learning! Try again. Or, type info() for more
| options.| Type x and press Enter. This will automatically print the value of x.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.