This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pacman::p_load(tidyverse) | |
gg_to_clipboard <- function(plot = last_plot(), width = 1000, height = 600, pointsize = 40){ | |
win.graph(width = width, height = height, pointsize = pointsize) | |
plot %>% print() | |
savePlot("clipboard", type = "wmf") | |
dev.off() | |
} | |
# ggplot(data = mtcars, aes(x = mpg)) + geom_histogram() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PREPARATIONS: | |
# | |
# * Have Teacher status in your Canvas course. | |
# * Get an API token for your Canvas account as described here: | |
# https://community.canvaslms.com/t5/Admin-Guide/How-do-I-manage-API-access-tokens-as-an-admin/ta-p/89 | |
# You only need to do this once. If you generate a new token, the old one becomes invalid. | |
# Keep your API token secret. It works like a password. | |
# * Find your course's ID number in Canvas. For example, course 1234 is at | |
# https://nmbu.instructure.com/courses/1234 | |
# * Install revision 7496d66 of rcanvas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save state on error to facilitate debugging | |
postmortem <- function() { | |
# SAVE TO SOMEWHERE BOTH YOU AND THE RUNNING PROGRAM HAVE ACCESS | |
save.image("postmortem.RData") | |
# Skip irrelevant levels of traceback, see the "If x is numeric" part of ?traceback. | |
traceback(3) | |
stop() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
codegen | |
~~~~~~~ | |
Extension to ast that allow ast -> python code generation. | |
:copyright: Copyright 2008 by Armin Ronacher. | |
:license: BSD. | |
""" |