Open jrosen48 opened 4 years ago
Hi, I think this is a great idea, though it may need a few iterations before we get it right. My first thought is to add a .Rprofile
file to root directory of the RStudio project that a student is working on. That .Rprofile
file should contain this code:
library(matahari)
dance_start()
.Last <- function() {
dance_stop()
pretty_date_time <- gsub(":", "", gsub(" ", "_", as.character(Sys.time())))
dance_save(paste0("matahari-log-", pretty_date_time, ".rds"))
}
That should produce a log every time a student starts and stops R, which will be saved to the root directory of the project. Let me know if that works!
Thanks so much. I think I understand how this works. I've tried this a few times in R Studio cloud, and haven't been able to view the log file yet. I also tried this locally, and haven't been able to see a file saved when I either close and open R Studio or restart my R session. I will keep working on this; I wonder if I'm doing something incorrectly (or not reloading/restarting my session correctly?).
I just tried to get this working on RStudio cloud and I could not, though it is working for me on my own computer. I will find some RStudio engineer to ask how .Last
is handled in RStudio cloud at RStudio conf next month. (I would ask online but I don't know who to ask.)
I got it to work but probably not in a way that is ideal for you class:
.Rprofile
above in the project directory and terminate R by typing q()
into the console..Rprofile
was run with exists(".Last")
.q()
. When R restarts there should be a log in the project directory.Let me know if that works.
Thanks for creating a great package.
I am currently using R Studio Cloud with middle grades-aged students. I am curious about whether I could use matahari to understand what code students write in a document. Apart from asking them to load matahari and to run the
dance_start()
anddance_stop()
commands manually (assuming they have shared their project with me), is there any way to do this in an (even) more seemless way?I am wondering about something like sourcing an R file that loads matahari and then runs
dance_start()
, but am not sure how to get the tracking to end without students manually runningdance_end()
. I know this question is a bit open-ended; thanks for considering this.