file.after.root = function(file, root) {
if (startsWith(file, root)) return(substring(file, nchar(root)+1))
file
}
is.true = function(x) {
x[is.na(x)] = FALSE
x
}
name.of.call = function(call) {
###restore.point("name.of.call")
if (is.symbol(call)) {
name = as.character(call)
if (is.na(name)) return("NA")
return(name)
}
name = as.character(call[[1]])
if (identical(name,"<-") | identical(name,"=")) {
name = name.of.call(call[[3]])
} else if (length(name)>1) {
name = paste0(name, collapse="")
}
name
}
deparse1 = function(call, collapse="\n") {
paste0(deparse(call, width=500, control = c("keepNA", "keepInteger", "niceNames", "showAttributes", "useSource")),collapse=collapse)
}
quick_df = function(...) {
as_tibble(list(...),validate=FALSE)
}
str_string = function(x) {
paste0(capture.output(str(x)), collapse="\n")
}
write.log = function(log.file,...) {
if (is.null(log.file)) return()
txt = paste0(..., sep="")
con = file(log.file,"at")
writeLines(txt, con)
close(con)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.