# Just to divide messages ----
messageline <- function(txt = NULL, width = 80) {
if(is.null(txt)) {
message(rep("-", width))
} else {
message(txt, " ", rep("-", width - nchar(txt) - 1))
}
}
# Read gz compressed CSV files ----
fread2 <- function(file, select = NULL, character = NULL, numeric = NULL) {
messageline()
messageline("function fread2")
messageline()
message("file: ", file)
if (str_sub(file, start = -2) == "gz") {
d <- fread(
cmd = paste("zcat", file),
select = select,
colClasses = list(
character = character,
numeric = numeric
)
) %>%
as_tibble() %>%
clean_names()
} else {
d <- fread(
input = file,
select = select,
colClasses = list(
character = character,
numeric = numeric
)
) %>%
as_tibble() %>%
clean_names()
}
return(d)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.