Last active
April 22, 2020 05:21
-
-
Save sumanstats/59db41e77edc7802a1e5a21a1239505d to your computer and use it in GitHub Desktop.
function to document dataset
This file contains hidden or 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
document_data <- function(dataset,R_file) { | |
initial = "#' WHAT IS THIS DATASET ABOUT | |
#' | |
#' WRITE DESCRIPTION OF THIS DATASET | |
#' | |
#' | |
#' @usage HOW TO USE | |
#' | |
#' @format Description | |
#' \\describe{" | |
middle=paste0("#' ","\\item{",names(dataset),"}","{}") | |
last = paste0("#' } | |
\"",deparse(substitute(dataset)),"\"") | |
write(c(initial,middle,last),R_file) | |
} | |
This file contains hidden or 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
# You can read csv with encoding UTF-8, this way it correctly shows nepali characters | |
file <- readr::read_csv("<data>.csv", | |
locale = readr::locale(encoding = "UTF-8")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment