Coder Social home page Coder Social logo

skranz / rtutor Goto Github PK

View Code? Open in Web Editor NEW
201.0 18.0 57.0 6.24 MB

Creating interactive R Problem Sets. Automatic hints and solution checks. (Shiny or RStudio)

Home Page: https://skranz.github.io/RTutor/

R 98.80% CSS 1.02% JavaScript 0.18%
rstats rstudio problem-set shiny learn-to-code r rtutor teaching economics

rtutor's Introduction

RTutor: Interactive R Problem Sets

Author: Sebastian Kranz, Ulm University

RTutor is an R package that allows to develop interactive R exercises. Problem sets can be solved off-line or can be hosted in the web with shinyapps.io. Problem sets can be designed as a Markdown .rmd file (to be solved directly in RStudio) or use a browser-based interface powered by RStudio's Shiny. While the web interface looks nicer, I personally use problem sets in the Markdown format when teaching advanced economic classes.

Installation

RTutor and some required packages are not hosted on CRAN (while CRAN is great it takes a lot of time to maintain several packages there). You can install it from my r-universe repository by using the following code:

options(repos = c(skranz = 'https://skranz.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))
install.packages("RTutor")

Create your own problem sets

Take a look at the manuals for documentation of how to create own problem sets. Also look at the examples below.

Trying out some problem sets

You can try out the Rmarkdown version of RTutor via RStudio Cloud:

https://rstudio.cloud/project/39040

For the web-based interface, several students at Ulm University have created very nice problem sets that allow to interactively replicate the main insights of interesting economic articles and to learn a bit about R and econometrics. Before developing your own problem sets, you may want to try out some of these examples:

The Effect of Water Pollution on Cancer (by Brigitte Peter)

Political Incentives and Water Pollution in China (by Simon Maier)

Economic Impact of Covid-19 (by Alexandra Aehle)

What explains the employment drop in the great recession 2007-2009? (by Birgit Schroff)

Comparing the Environmental Damages of Driving Electric or Gasoline Cars (by Felix Stickel)

The causal effects of Sweden's CO2 Tax (by Theresa Graefe)

Public Procurement Auctions: Design, Outcomes and Adaption Costs (by Frederik Collin)

Poverty Reduction and Deforestation (by Katharina Kaufmann)

How soap operas reduced fertility in Brazil (by Clara Ulmer)

Excessive Traffic Jams? Improving Incentive Contracts for Road Construction Projects (by Claudius Schmid)

The impact of competition policy and industrial policy on economic development (by Julian Latzko)

Analyzing Mozart's letters: How emotions determine creativity (by Daniel Klinke)

Estimating Central Bank Objectives using Text Analysis (by Julian Lenhardt)

Assessing Free Trade Agreements (by Tobias Fischer)

CO2 Trading and Risk of Firm Relocation (by Benjamin Lux)

The Effects of Defaults on Donations (by Stefanie Buda)

Insurance and the Church (by Adidti Malani)

Public Infrastructure Spending and Voting Behaviour (by Philipp Klotz)

On the optimal taxation of top incomes (by Jonas Send)

The effect of the TseTse fly on African Development (by Vanessa Schöller)

Pollution Reduction by Wind Energy (by Anna Sophie Barann)

Wall Street and the Housing Bubble (by Marius Wentz)

How much less effective are publicly assigned lawyers? (by Artemij Cadov)

Air pollution and house prices (by Moritz Sporer)

Female Role Models for Potential Economics Students (by Stefanie Buda)

Predicting Effects of Carbon Pricing on US Electricity Production (by Daniel Dreyer)

A macroeconomic study of credit booms and busts (by Thomas Clausing)

The impact of emmission trading on green innovation (by Arthur Schäfer)

Social Spillovers in Movie Consumption (by Lara Santak)

Building Codes and Energy Efficiency (2 versions, by Simon Hertle and Lisa Eilts)

Gasoline Prices and Consumer Behavior (by Melina Klenk)

Technological Progress and Fuel Economy of Cars (by Marius Breitmayer)

Experiment zu sozialen Netzwerken und Vertragserfuellung (by Fabian Zeiher)

Long-Term Effects of Communism in Eastern Europe (by Benjamin Markert)

How can Scandinavians tax so much? (by David Hertle)

An interesting case study of a bank run (by Joachim Plath)

Courses that use RTutor problem sets

If you a have course that uses RTutor that you want to share, just send me an email and I add your course to the list!

  • Two courses from me: Empirical Economics with R and Market Analysis with Econometrics and Machine Learning. Both consists of online shiny apps with videos and quizzes and many RTutor problem sets.

  • Jade Benjamin-Chung from UC Berkeley School of Public Health has created with RTutor online tutorials for an introductory R course for epidemiologists. If you click on a tutorial the corresponding RTutor problem set can be directly solved on shinyapps.io. There is no need to log in.

  • RTutor is also used in a compulsory data science project course taught by Alex Rieber for business and economics students at Ulm University. The problem sets teach basic skills in R, including tidyverse data wrangling, as well as econometric and machine learning basic with economic applications. Alex published the problem sets and other course material here on Github. You find on the Github pages also links that allow you to test the problem sets on the rstudio cloud. The course is in German but Alex already started to make an English version of the problem sets, which will be added once finished.

Installing RTutor directly from Github

To install RTutor and required packages directly from Github and CRAN, you can use the small function in the following gist:

https://gist.github.com/skranz/fad6062e5462c9d0efe4

Copy the code in the link into your R console and then run:

install.rtutor(update.github=TRUE)

Depending on your devtools version, also the following code may work directly (yet source_gist is buggy in some devtools versions):

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)

If you only want to update the RTutor package (and have the other packages already installed). You can just type:

devtools::install_github("skranz/RTutor", upgrade="ask")

(You may have to restart your R session / RStudio for the update to work.)

Suggestions & Feedback

If you have suggestions or find bugs, please don't hesitate to open an issue on the Github page.

rtutor's People

Contributors

martinkies avatar skranz avatar stephlocke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtutor's Issues

New Options regarding rtutor.app.skel

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

  1. Receive ps.show arguments and directly transfer them through. This allows to directly deploy an app which does not show solution buttons without having to go into global.R
  2. Hide the "Download in RMarkdown" Button. I would much rather give my users directly the html file rather than having them build their own and receiving RMarkdown code.
  3. Specify a different fork of RTutor - this allows us to use our GitHub Version for the shinyapps without having to manually change it in deployapps
  4. Tell deployapps to have both safety if-clauses in deployapp off (i.e. set to TRUE).
  5. Set the shinyapps.io Account info directly.

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.

Example does not work in Rstudio

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.

Running example chunk

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

Hints

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.

highlight boxes

I just changed a few things in the LeverageData Fork

The most important ones are:

  • Highlight Boxes (see https://leveragedata.shinyapps.io/HighlightExample/)
  • Various changes regarding output_solution to fix inconsistencies between knitr and shiny [probably] by retroactively changing some of the source code. Mainly by adding or deleting line breaks and blank lines. Additionally a possible top level header (# ...) will be used instead of the problem set name for the Header of the output_solution.
  • A small fix regarding info_blocks, which may now have the same title. Previously the last info block with the same title overrode the content of the previous ones with the same title.

Pre-run code chunks?

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.

show.ps leads to grey-screen Shiny App

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.
image
image

--
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.

Test that would allow open text

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?

hints based on check.call

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?

Width of Quizzes

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?

Thank you in advance,
Martin
Quiz small

Installation issue;

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' ...

  • preparing 'stringtools':
    √ checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'stringtools_0.01.tar.gz'

Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

  • installing source package 'stringtools' ...
    ** using staged installation
    ** R
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    converting help for package 'stringtools'
    finding HTML links ... done
    adapt.blocks.after.replace html
    adapt.pos.after.replace html
    blocks.add.level.0 html
    char.matrix.to.str html
    char.vector.to.str html
    check.str.par html
    combine.pos.and html
    combine.pos.list.and html
    cumsum.ignore html
    get.ignore html
    has.substr html
    ignore.and.complement.pos html
    ignore.to.pos html
    merge.lines html
    pos.complement html
    pos.to.ignore html
    pos.with.complement html
    regexp.fixed html
    replace.german.umlaute html
    sep.lines html
    str.at.pos html
    str.between html
    str.blocks.pos html
    str.detect html
    str.ends.with html
    str.extract.all html
    str.extract.first html
    str.find html
    str.inpos html
    str.left html
    str.left.of html
    str.len html
    str.list.to.regexp.or html
    str.locate.all html
    str.locate.at.end html
    str.locate.at.start html
    str.locate.first html
    str.matches.pattern html
    str.number.matches html
    str.remove.ends html
    str.remove.ignore html
    str.replace html
    str.replace.at.pos html
    str.replace.by.blocks html
    str.replace.list html
    str.right html
    str.right.of html
    str.space html
    str.split html
    str.split.at.pos html
    str.starts.with html
    str.tokenize html
    str.trim html
    to.char.matrix html
    to.char.vector html
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    *** arch - i386
    *** arch - x64
    ** testing if installed package can be loaded from final location
    *** arch - i386
    *** arch - x64
    ** testing if installed package keeps a record of temporary installation path
  • DONE (stringtools)
    Downloading GitHub repo skranz/shinyEvents@master
    √ checking for file 'C:\Users\liew_\AppData\Local\Temp\Rtmp8QG1SH\remotesf6041bb4be4\skranz-shinyEvents-1d32196/DESCRIPTION' ...
  • preparing 'shinyEvents':
    √ checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'shinyEvents_2.3.tar.gz'

Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

  • installing source package 'shinyEvents' ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error: (converted from warning) package 'restorepoint' was built under R version 3.6.1
    Execution halted
    ERROR: lazy loading failed for package 'shinyEvents'
  • removing 'C:/Users/liew_/OneDrive/Documents/R/win-library/3.6/shinyEvents'
    Error : Failed to install 'shinyEvents' from GitHub:
    (converted from warning) installation of package ‘C:/Users/liew_/AppData/Local/Temp/Rtmp8QG1SH/filef6027f11e10/shinyEvents_2.3.tar.gz’ had non-zero exit status
    In addition: Warning messages:
    1: package ‘whisker’ was built under R version 3.6.1
    2: package ‘markdown’ was built under R version 3.6.1
    3: package ‘dplyr’ was built under R version 3.6.1
    4: package ‘shinyBS’ was built under R version 3.6.1
    5: package ‘zoo’ was built under R version 3.6.1
    6: package ‘texreg’ was built under R version 3.6.1
    7: package ‘shinyAce’ was built under R version 3.6.1
    8: package ‘restorepoint’ was built under R version 3.6.1
    Downloading GitHub repo skranz/dplyrExtras@master
    √ checking for file 'C:\Users\liew_\AppData\Local\Temp\Rtmp8QG1SH\remotesf6030a75c54\skranz-dplyrExtras-325491a/DESCRIPTION' ...
  • preparing 'dplyrExtras':
    √ checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'dplyrExtras_0.1.3.tar.gz'

Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

  • installing source package 'dplyrExtras' ...
    ** using staged installation
    ** R
    ** byte-compile and prepare package for lazy loading
    Error: (converted from warning) package 'dplyr' was built under R version 3.6.1
    Execution halted
    ERROR: lazy loading failed for package 'dplyrExtras'
  • removing 'C:/Users/liew_/OneDrive/Documents/R/win-library/3.6/dplyrExtras'
    Error : Failed to install 'dplyrExtras' from GitHub:
    (converted from warning) installation of package ‘C:/Users/liew_/AppData/Local/Temp/Rtmp8QG1SH/filef60eee781a/dplyrExtras_0.1.3.tar.gz’ had non-zero exit status
    Downloading GitHub repo skranz/regtools@master
    √ checking for file 'C:\Users\liew_\AppData\Local\Temp\Rtmp8QG1SH\remotesf6014bb462d\skranz-regtools-426fb24/DESCRIPTION' ...
  • preparing 'regtools':
    √ checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'regtools_2018.11.20.tar.gz'

Installing package into ‘C:/Users/liew_/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

  • installing source package 'regtools' ...
    ** using staged installation
    ** R
    ** byte-compile and prepare package for lazy loading
    Error: (converted from warning) package 'restorepoint' was built under R version 3.6.1
    Execution halted
    ERROR: lazy loading failed for package 'regtools'
  • removing 'C:/Users/liew_/OneDrive/Documents/R/win-library/3.6/regtools'
    Error : Failed to install 'regtools' from GitHub:
    (converted from warning) installation of package ‘C:/Users/liew_/AppData/Local/Temp/Rtmp8QG1SH/filef601d647e7d/regtools_2018.11.20.tar.gz’ had non-zero exit status
    Downloading GitHub repo skranz/RTutor@master
    √ checking for file 'C:\Users\liew_\AppData\Local\Temp\Rtmp8QG1SH\remotesf6077b938af\skranz-RTutor-9ee4a5a/DESCRIPTION' ...
  • preparing 'RTutor': (367ms)
    √ checking DESCRIPTION meta-information ...
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'RTutor_2019.07.31.tar.gz'

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'

  • removing 'C:/Users/liew_/OneDrive/Documents/R/win-library/3.6/RTutor'
    Error : Failed to install 'RTutor' from GitHub:
    (converted from warning) installation of package ‘C:/Users/liew_/AppData/Local/Temp/Rtmp8QG1SH/filef6052154d78/RTutor_2019.07.31.tar.gz’ had non-zero exit status
    Show Traceback

Rerun with Debug
Error in library(RTutor) : there is no package called ‘RTutor’ *

Much appreciated for any help.
Bernard

Updates in RTutor Main Branch

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.

Duplicated exercise names cause errors

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.

"Go to next exercise" Button does not trigger generation of code chunks

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.

MWE_sol.zip

Warning: Error in : colourInput() has been moved to the 'colourpicker' package.

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

Controlling the width of the quizzes

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 ?

Probleme mit neuer RTutor Version

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'

  • removing 'C:/Users/Elefant/Documents/R/win-library/3.0/RTutor'
    Error: Command failed (1)

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

Linux - RStudio installation problem

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):

Thanks in advance any way...

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

Loading required package: shinyBS
Loading required package: hwriter
trying URL 'https://cran.rstudio.com/src/contrib/hwriter_1.3.2.tar.gz'
Content type 'application/x-gzip' length 114012 bytes (111 KB)

downloaded 111 KB

  • installing source package ‘hwriter’ ...
    ** package ‘hwriter’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (hwriter)

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

Loading required package: texreg
trying URL 'https://cran.rstudio.com/src/contrib/texreg_1.36.23.tar.gz'
Content type 'application/x-gzip' length 494898 bytes (483 KB)

downloaded 483 KB

  • installing source package ‘texreg’ ...
    ** package ‘texreg’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
  • DONE (texreg)

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

Loading required package: memoise
Loading required package: shinyAce
trying URL 'https://cran.rstudio.com/src/contrib/shinyAce_0.2.1.tar.gz'
Content type 'application/x-gzip' length 1713619 bytes (1.6 MB)

downloaded 1.6 MB

  • installing source package ‘shinyAce’ ...
    ** package ‘shinyAce’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (shinyAce)

The downloaded source packages are in
‘/tmp/RtmpD9qGZg/downloaded_packages’

Install required packages from Github...Downloading GitHub repo skranz/restorepoint@master
from URL https://api.github.com/repos/skranz/restorepoint/zipball/master
Installation failed: error in running command
Downloading GitHub repo skranz/stringtools@master
from URL https://api.github.com/repos/skranz/stringtools/zipball/master
Installation failed: error in running command

Tabs also at the end of the page

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

Cutoff for Exercisename

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?

Window Position when clicking on "Go to next exercise..."

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?

Desired behavior of check.assign

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?

Major update Branch LeverageData (mostly regarding quizzes)

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:

  • It is now possible to have a shiny problem set without programming chunks (both locally and on shinyapps)
  • Exercises do no longer throw an error when ending with a chunk.
  • Several improvements regarding quizzes:
    • It is now possible to use a colon (":") in quizzes (question, success/failure message, choices, commentary [see below]) without destroying the yaml structure or having to use any escape characters.
    • Quizzes now support RMD formatting, including MathJax. Beside other things this allows it to bold and italize text as well as the use of Math formulas in all quiz-related texts. Note: An exception has been made with numbered lists. Here I use regular expressions to suppress RMDs urge to fix mislabeled data. This way one can start a quiz with "2." without it being corrected to "1.". This is especially useful in the context of multi-part quizzes.
    • Quizzes also support direct HTML code. This way one can for example change the color of (parts of) the text and use smilies or other fancy characters. In particular it is now possible to have images as choices (!).
    • It is now possible to provide arbitrary commentary to the answers of single choice and multiple choice quizzes depending on all possible user input-combinations. One is therefore not limited to simply tell the user that the input of a mc quiz has been wrong but can also give helpful pointers which particular answers have been wrong or are missing.

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:

  • Should someone by accident written a quiz where part of the text can be interpreted as either HTML or RMD, than these changes apply. This might for example be if someone has written something like 4*4=2*8 which now becomes 44=28. I nevertheless opted for the RMD behavior of quizzes as the default, as it now behaves as the rest of RTutor which is what one would assume as a new user.
  • In the case of someone having used the string COLON than this gets changed to a ":".

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.

Executing invisible code

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.

Namensgebung des zu erstellenden Problemsets

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

Question regarding mark_utf8

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.