skranz / rtutor Goto Github PK
View Code? Open in Web Editor NEWCreating interactive R Problem Sets. Automatic hints and solution checks. (Shiny or RStudio)
Home Page: https://skranz.github.io/RTutor/
Creating interactive R Problem Sets. Automatic hints and solution checks. (Shiny or RStudio)
Home Page: https://skranz.github.io/RTutor/
There is a different behavior in the generation of code chunks when going through the tab at the top and the next exercise button.
In particular the code chunks are not necessarily rendered at all. Please find attached a minimum working example where going through the tabs does generate the code chunk but ging through next exercise does not.
Hallo Sebastian,
Ich sitze hier gerade an der IV Aufgabe und mir fällt einfach nicht mehr ein, wie man als Student später die Hints aufrufen konnte, wenn ich extra Hints außerhalb der Test Funktionen einfügen möchte. Wäre super wenn du mir da helfen könntest.
mit hint("Name des Hints") funktioniert es schonmal nicht :).
Viele Grüße
Beat
PS: Bis Mittwoch hatte ich es leider doch nicht geschafft, etwas vorzeigbares zu liefern. Tut mir Leid.
Hi,
While using rtutoR, I am facing below warning and after that the package stops working(do not plot anything)
Warning: Error in : colourInput() has been moved to the 'colourpicker' package.
111:
Warning: Error in if: argument is of length zero
[No stack trace available]
Somehow it is referencing ColorInput, however colourpicker is installed and loaded just before running the rtutoR package
In another thread, it was mentioned that colourpicker 1.2 on github works but 1.1.1.9 is one available on github
Hallo,
Ist es möglich die Dokumente eigenständig umzubenennen? Also das ich nicht unbedingt in der My_first_ps_struc arbeiten muss, um ein wenig Ordnung zu halten, wenn ich mehrere Aufgaben erstelle?
Gruß Beat
It would be nice to have the tabs to switch between different chapters also at the end of every chapter to simplify navigation through the problem set.
Regards, Jonas
The examples you are using for the quizzes are usually short, i.e. number.
I want the respondents to select between different longer sentences. When doing so each possible choices spans other several lines (since the width seems to be set to around 40 to 50 characters. )
Is there a command (or a way) to change this width ?
Hi,
When running this example chunk
```{r "setup"}
library(RTutor)
setwd(getwd())
ps.name = "myps"; sol.file = paste0(ps.name,"_sol.Rmd")
libs = c("ggplot2") # character vector of all packages you load in the problem set
#name.rmd.chunks(sol.file)
create.ps(sol.file=sol.file, ps.name=ps.name, libs=libs)
# The following line directly shows the problem set
# in the browser
show.ps(ps.name,launch.browser=TRUE,
auto.save.code=FALSE,sample.solution=FALSE)
```
create.ps(sol.file=sol.file, ps.name=ps.name, libs=libs)
threw an error of
Error in cdt[ci, ] : incorrect number of dimensions
Regards,
Bernard
Hey there,
I seem to be having issues specifically with demo material on vignettes and linked from the GitHub mainpage.
Specifically, when I go to the RStudio Cloud demo here and log in, I have a temporary copy of your project.
Then, if I run the code chunk in the README.md, I'm first prompted to install RTutor:
Error in library(RTutor) : there is no package called ‘RTutor’
Okay, so I install with the following:
install.packages("RTutor",repos = c("https://skranz-repo.github.io/drat/",getOption("repos")))
Now, I run the code chunk:
library(RTutor)
show.ps("Intro", user.name="TestUser")
A new window spawns but the Shiny App is greyed out, though I've discovered I can actually still click around within the app, though all of the code chunks seem to have vanished.
--
I'm also having the exact same issue on my own RStudio Server instance, where I've created a file called Example_sol.Rmd that is identical to the one in the Guide for Developing Interactive R Problemsets Vignette. With this, I'm able to run create.ps just fine but running show.ps with the example problemset spawns a greyed out screen and no code chunks for me to fill out.
I ran into to the warning that my exercise names are identical. The reason for this was that only the first 20 characters are used for the comparison. Something like
Konfidenzintervalle Teil 1
Konfidenzintervalle Teil 2
e.g. is therefore not possible without generating the warning and having sub-optimal chunk-names.
I set the limit to 99 in my fork and as far as I see there were no negative consequences and everything works as intended now.
Is there a specific reason for the limitation to 20 characters which might result in undesired behavior down the line if one weakens it to 99 chars?
Hi,
I wanted to be able to have certain code chunks already executed when rendered to for example, show a plot or display a table. Is that currently supported, and if not, would it be possible to add that feature? Thanks so much.
Hallo Sebastian,
ich habe Probleme mit der Installation der neuen RTutor Version.
Auf den Befehl
install_github(repo = "RTutor", username = "skranz")
folgt die Fehlermeldung
*** arch - i386
Error in namespaceExport(ns, exports) : undefined exports: hint.for
Error: loading failed
Execution halted
*** arch - x64
Error in namespaceExport(ns, exports) : undefined exports: hint.for
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
Vll. kannst du das RTutor als Package verpacken damit ichs von Hand nochmal versuchen kann (ohne den Umweg über den Download von Github).
Freundliche Grüße
Beat
Hello :),
I have the curious behavior, that my quizzes do not use the available space (see Picture).
I found nothing to control the width in the documentation nor in the source code of the package. In fact I am quite unsure why this happens, as I found nothing limiting the width either - but I might have easily missed this. Do you have an idea how one can set the width of the quiz to the same width as the rest of the text?
Hello, its me again. I found pretty strange behavior regarding the deletion of columns of a data frame (and possibly a matrix, not tested). Please find a MWE attached.
Get a strange error about "out" not found
The default behavior of check.assign is ok.if.same.val = TRUE. The description states that FALSE is the default. I was quite confused why my expressions went through. Which is the desired behavior?
Hello,
I ran into an issue you might want to be addressed more gracefully: if you have an exercise with a certain name and another exercise later in the document with the same name, the first exercise will show up with just text and no code chunks, and the second exercise won't show up at all.
For example, if I do:
Exercise 1 - Labelling graphs
text1
code-chunk1
Exercise 1 - Changing axes
code-chunk2
The "Labelling graphs" exercise will show up as a tab and have text1, but won't have code-chunk1 and the "Changing axes" exercise just won't show up entirely.
Just wanted to let you know! You can replicate it here if you change "Exercise 3" to "Exercise 2" on line 126.
This is not really an issue, but a question.
I would like to write a task where students should comment in a free (but limited) text their results, for example ask them to comment what they deduct from the graph. So that would be a text that is not checked for right or wrong, but something that would be saved when students send their results. This would be an open text (not some code)
Is there a way to do this?
I just changed a few things in the LeverageData Fork
The most important ones are:
I just uploaded a major update to the LeverageData Fork.
The direct effects of the changes can be seen here: https://leveragedata.shinyapps.io/QuizExamples/
In particular I made the following improvements:
All changes are as backwards compatible as possible. All current problem sets should compile as previously and all additional options are stricly optional. The following caveats apply however:
Additionally I changed the commentary in deployapps so that the dataset should be in ./app instead of ./app/work. I am quite confused about this one. ./app./work worked fine until it didn't anymore for newly uploaded problem sets. I am not sure whether this was a change made by myself or by shinyapps. You might want to consider whats happening here seperately from the other changes.
Could you give me a pointer regarding the usage of hints when working with check.call instead of check.assign and check.function?
Say I want the student to use a two-sample t-test (but expressively not a Welch-test!). The following workaround does the trick:
#< task
#Write your solution here.
#>
my.test <- t.test(column1, column1, var.equal=TRUE)
#< hint
if(true(identical(my.test,t.test(column1, column2)))){
cat("You have used the Welch-Test. Use the option var.equal=TRUE" )}
#>
my.test
The automatic hint directs the student to the missing option, but I think it is helpful to give context information.
It would be nice however if I could write something like
#< task
#Write your solution here.
#>
t.test(column1, column1, var.equal=TRUE)
#< hint
if(true(identical(<expr_student>,t.test(column1, column2)))){
cat("You have used the Welch-Test. Use the option var.equal=TRUE" )}
#>
This way the student would not have to do the artifical step to first save and then display the variable, as we are only interested in interpreting the output.
Is this possible/did I miss this in the manual?
I added a lot of flexibility to the rTutor.app.skel Function in the LeverageData Fork as this suits our workflow. I am not sure which of those changes are in your interest, so I splittet them into different commits. In detail the new version is now possible to
These in combinations allow us to have a single easily adaptable AppSkelett which directly generates the desired shinyapps and easily deploy them by sourcing deployapps.R without further modifications. This is quite helpful if one generates a lot of apps.
Hi,
I cannot seem to run the command in my console. It results in an error
if (!require(devtools))
install.packages("devtools")
devtools::source_gist("gist.github.com/skranz/fad6062e5462c9d0efe4", filename="install_rtutor.r")
install.rtutor(update.github=TRUE)
library(RTutor)
Install required packages from CRAN...Loading required package: withr
Loading required package: whisker
Loading required package: stringr
Loading required package: jsonlite
Loading required package: data.table
data.table 1.12.2 using 4 threads (see ?getDTthreads). Latest news: r-datatable.com
Loading required package: markdown
Loading required package: DT
Loading required package: dplyr
Attaching package: ‘dplyr’
The following objects are masked from ‘package:data.table’:
between, first, last
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Loading required package: shiny
Attaching package: ‘shiny’
The following objects are masked from ‘package:DT’:
dataTableOutput, renderDataTable
The following object is masked from ‘package:jsonlite’:
validate
Loading required package: shinyBS
Loading required package: hwriter
Loading required package: lmtest
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: texreg
Version: 1.36.23
Date: 2017-03-03
Author: Philip Leifeld (University of Glasgow)
Please cite the JSS article in your publications -- see citation("texreg").
Loading required package: RCurl
Loading required package: bitops
Attaching package: ‘RCurl’
The following object is masked from ‘package:lmtest’:
reset
Loading required package: memoise
Loading required package: shinyAce
Loading required package: restorepoint
Install required packages from Github...Downloading GitHub repo skranz/stringtools@master
√ checking for file 'C:\Users\liew_\AppData\Local\Temp\Rtmp8QG1SH\remotesf60101c4ca5\skranz-stringtools-d03fb55/DESCRIPTION' ...
Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
ERROR: dependencies 'shinyEvents', 'dplyrExtras' are not available for package 'RTutor'
Rerun with Debug
Error in library(RTutor) : there is no package called ‘RTutor’ *
Much appreciated for any help.
Bernard
I am trying to get the Example problem set working in Rstudio.
When I use the check problemset addin, I get the following errors:
---------------------------
Save and check problem set file ~/somelocation.Rmd ...
Warning in readLines(ps$stud.file) :
line 3 appears to contain an embedded nul
...
loads of those warnings
...
Warning in readLines(ps$stud.file) :
line 369 appears to contain an embedded nul
Warning in readLines(ps$stud.file) :
incomplete final line found on '/home/willem/git/training/sameness/sameness_training.rps'
Error in substring(txt, 1, nchar(pattern)): invalid multibyte string at '<ff>'
And it does not seem to work.
Thanks for your efforts in making RTutor shared!
I am wondering if it is possible to use RTutor in Linux. Here is my experience:
I tried the solution on:
https://stackoverflow.com/questions/38345894/r-source-gist-not-working
the following get over the source_git problem :
devtools::source_gist("fad6062e5462c9d0efe4", filename = "install_rtutor.r")
But then (here is the R command I issued and the messages up to the first error):
install.rtutor(update.github=TRUE)
Install required packages from CRAN...Loading required package: whisker
Loading required package: stringr
Loading required package: jsonlite
Loading required package: data.table
data.table 1.10.4.2
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
Release notes, videos and slides: http://r-datatable.com
Loading required package: markdown
Loading required package: DT
Loading required package: dplyr
Attaching package: ‘dplyr’
The following objects are masked from ‘package:data.table’:
between, first, last
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Loading required package: shiny
Attaching package: ‘shiny’
The following objects are masked from ‘package:DT’:
dataTableOutput, renderDataTable
The following object is masked from ‘package:jsonlite’:
validate
downloaded 111 KB
The downloaded source packages are in
‘/tmp/RtmpD9qGZg/downloaded_packages’
Loading required package: lmtest
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
downloaded 483 KB
The downloaded source packages are in
‘/tmp/RtmpD9qGZg/downloaded_packages’
Loading required package: RCurl
Loading required package: bitops
Attaching package: ‘RCurl’
The following object is masked from ‘package:lmtest’:
reset
downloaded 1.6 MB
The downloaded source packages are in
‘/tmp/RtmpD9qGZg/downloaded_packages’
When testing my problem sets I found that clicking on the "Go to next exercise..." button on RShiny brings me to the very top of the next exercise only when I test it with an uploaded shinyapps.io problemset and a never-before loaded exercise.
If I test it locally OR when I go back to the previous exercise and click the button again in shinyapps.io my viewing window centers not at the very top but somewhere within the exercise - probably exactly the middle.
This happens consistenly independent on the used Browser (tested: Chrome, Edge) and the problemset (tested: own, Clara Ulmer, FCollin).
Is there a way to force the "Go to next exercise..." button to always go to the very top of the next exercise?
I am working on a multi-day course where the data set is iteratively cleaned and transformed with an online RTutor Shinyapp. I would like the participants to pause and continue reasonably often and use the exercises to break up the course into several small pieces.
It would be great if the participants could seamlessly pick up their work and and continue with the data set after the transformations. If I understand the manual correctly the proposed solution to do so is to include a chunk at the beginning of each exercise forcing the participant to go through all steps again.
A possible alternative could be to design save points (e.g. using Rdata files) and have the participant load them at the beginning of each exercise. I would prefer it however, if this would happen without the participant having to do so manually as this might prove bothersome if it has to be done a lot.
Is it possible to invisibly execute code when loading an exercise similar to an automatically loaded "include=FALSE" RMD chunk? I played with preknit chunks and tried to directly use RMD code but this did not work.
Hi there,
I'm trying to generate a new problemset using create.ps
to no avail. Specifically, I'm getting the following error:
Error in eval(base::parse(text = code, srcfile = NULL)) : object 'setup' not found
This is the file I'm using to generate the problemset, if its helpful as a reference. I can also confirm that create.ps works on the Example_sol.Rmd file linked in this vignette.
In write.output.solution
(create_ps.r) you have
out.txt = mark_utf8(out.txt)
I am unsure about its purpose. This line sometimes leads to errors when used before my function "fix.parser.inconsistencies" due to incompatibilities with the stringr package, e.g. regarding stringr::str_length().
Uncommenting the line fixes the error and the resulting solution looks fine to me (in particular regarding Umlauts). Perhaps the following code makes my point more clear:
fix.parser.inconsistencies("Test ü")
[1] "Test ü"
mark_utf8("Test ü")
[1] "Test \xfc"
str_length("Test ü")
[1] 6
str_length("Test \xfc")
[1] 6
str_length(mark_utf8("Test ü"))
[1] NA
Warnmeldung:
In stri_length(string) :
invalid UTF-8 byte sequence detected; try calling stri_enc_toutf8()
fix.parser.inconsistencies(mark_utf8("Test ü"))
[1] "Test �"
I am a bit wary whether uncommenting the line is the way to go, because I do not fully understand what its purpose is. Maybe I found an error in mark_utf8 itself, als str_length("Test \xfc") does work?
This issue shall describe updates I implemented in my RTutor branch. It is in particular targeted to maintainers of actively developed alternative branches (currently @MartinKies). Active discussion is encouraged.
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.