# Restore original data types
data.types <- as.data.table(x = t(shallow.copy[, lapply(X = .SD, FUN = "class")]), keep.rownames = TRUE)
unique.types <- data.types[V1 != "character", unique(V1)]
if(length(unique.types) > 0){
for(i in 1:length(unique.types)){
dat[, names(.SD) := lapply(X = .SD, FUN = "as", Class = unique.types[i]), .SDcols = data.types[V1 == unique.types[i], rn]]
}
}
# Limit rows if nrows < .N
dat <- dat[1:min(c(.N, nrows)),]
# return data
return(dat[])
}
grep_read(path = path, include_filename = T, show_line_numbers = T)
grep_read(path = path, show_line_numbers = T)
grep_read(path = path)
path
grep_read(path = "~/Downloads/data sets/", recursive = TRUE, pattern = "VVS")
files = NULL
path = "~/Downloads/data sets/", recursive = TRUE
files = NULL
path = "~/Downloads/data sets/"
recursive = TRUE
pattern = "VVS"
file_pattern = NULL
invert = FALSE
ignore_case = FALSE
fixed = FALSE
recursive = T
word_match = FALSE
only_matching = FALSE
skip = 0
header = TRUE
include_filename = FALSE
show_cmd = FALSE
show_progress = FALSE
show_line_numbers = FALSE
only_matching = FALSE
nrows = Inf
skip = 0
col.names = NULL
require(data.table)
# Ensure data.table is available
if (!requireNamespace("data.table", quietly = TRUE)) {
stop("The 'data.table' package is required but not installed. Please install it via install.packages('data.table').")
}
if (is.null(include_filename)) {
include_filename <- FALSE
}
if((is.null(files)) & !is.null(path)){
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
}
files
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
shallow.copy <- fread(input = files[1], nrows = 10)
shallow.copy
files = files[1:2]
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
cmd
files = path
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
cmd
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
files
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
cmd
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
file_pattern = ".csv"
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
files
options <- c("-v", "-i", "-F", "-r", "-w", "-o", "-c", "-H")[c(invert, ignore_case, fixed, recursive, word_match, only_matching, count_only, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Note:  header=F prevents placing the first file's count in the output's header.  This is different from including the values in the file's header in the count of matching patterns.
dat <- fread(cmd = cmd, header = F, skip = skip, showProgress = show_progress)
dat
options
require(data.table)
# Ensure data.table is available
if (!requireNamespace("data.table", quietly = TRUE)) {
stop("The 'data.table' package is required but not installed. Please install it via install.packages('data.table').")
}
if (is.null(include_filename)) {
include_filename <- FALSE
}
if((is.null(files)) & !is.null(path)){
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
}
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
cmd
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
shallow.copy <- fread(input = files[1], nrows = 10)
shallow.copy
pattern
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
pattern = ""
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
dat
pattern = "3"
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
dat
pattern = "FLX"
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
dat <- fread(cmd = cmd, header = F)
dat
# Set an artificial header of V1, V2, etc.
tryCatch(dat <- fread(cmd = cmd, header = F))
pattern = "VVS"
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
tryCatch(dat <- fread(cmd = cmd, header = F))
# Set an artificial header of V1, V2, etc.
tryCatch(dat <- fread(cmd = cmd, header = F), finally = data.table())
dat
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
tryCatch(dat <- fread(cmd = cmd, header = F), finally = shallow.copy[-(1:.N)])
dat
dat <- shallow.copy[-c(1:.N),]
dat
grep_read <- function(files = NULL, path = NULL, file_pattern = NULL, pattern = "", invert = FALSE, ignore_case = FALSE, fixed = FALSE, show_cmd = FALSE, recursive = FALSE, word_match = FALSE, show_line_numbers = FALSE, only_matching = FALSE, nrows = Inf, skip = 0, header = TRUE, col.names = NULL, include_filename = FALSE, show_progress = FALSE, ...) {
require(data.table)
# Ensure data.table is available
if (!requireNamespace("data.table", quietly = TRUE)) {
stop("The 'data.table' package is required but not installed. Please install it via install.packages('data.table').")
}
if (is.null(include_filename)) {
include_filename <- FALSE
}
if((is.null(files)) & !is.null(path)){
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
}
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
tryCatch(expr = dat <- fread(cmd = cmd, header = F), finally = data.table())
if(dat[, .N == 0]){
dat <- shallow.copy[-c(1:.N),]
}
# Handles all names except V1, which is addressed after potentially splitting columns downstream.
setnames(x = dat, old = names(dat), new = c("V1", names(shallow.copy)[2:ncol(shallow.copy)]), skip_absent = TRUE)
# Split first column if metadata is included.
if(need_metadata == TRUE){
column.names <- c(c("file", "line_number")[c((include_filename == T | length(files > 1)), show_line_numbers == T)], names(shallow.copy)[1])
additional.columns = split.columns(x = dat[, V1], column.names = column.names, resulting.columns = length(column.names))
dat <- data.table(dat, additional.columns)
dat[, V1 := NULL]
setcolorder(x = dat, neworder = names(shallow.copy), skip_absent = T)
if(include_filename == FALSE & "file" %in% names(dat)){
dat[, file := NULL]
}
if(show_line_numbers == FALSE & "line_number" %in% names(dat)){
dat[, line_number := NULL]
}
}
if(need_metadata == FALSE){
setnames(x = dat, old = "V1", new = names(shallow.copy)[1], skip_absent = TRUE)
}
header_contains_pattern <- length(grep(pattern = pattern, x = names(dat))) > 0
# Remove header rows
if(header == TRUE){
if((pattern == "") | (pattern != "" & header_contains_pattern == TRUE)){
num.files <- length(files)
if(num.files == 1){
dat <- dat[2:.N,]
}
if(num.files > 1){
counts <- grep_count(files = files, path = path, file_pattern = file_pattern, pattern = pattern, invert = invert, ignore_case = ignore_case, fixed = fixed, recursive = recursive, word_match = word_match, only_matching = only_matching, skip = skip, header = header)
dat <- dat[-c(1, 1 + counts[1:(.N-1), cumsum(1 + count)])]
}
}
}
if(header == TRUE & "line_number" %in% names(dat)){
dat[, line_number := as.numeric(line_number) - 1]
}
# Restore original data types
data.types <- as.data.table(x = t(shallow.copy[, lapply(X = .SD, FUN = "class")]), keep.rownames = TRUE)
unique.types <- data.types[V1 != "character", unique(V1)]
if(length(unique.types) > 0){
for(i in 1:length(unique.types)){
dat[, names(.SD) := lapply(X = .SD, FUN = "as", Class = unique.types[i]), .SDcols = data.types[V1 == unique.types[i], rn]]
}
}
# Limit rows if nrows < .N
dat <- dat[1:min(c(.N, nrows)),]
# return data
return(dat[])
}
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "")
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "VVS")
grep_read <- function(files = NULL, path = NULL, file_pattern = NULL, pattern = "", invert = FALSE, ignore_case = FALSE, fixed = FALSE, show_cmd = FALSE, recursive = FALSE, word_match = FALSE, show_line_numbers = FALSE, only_matching = FALSE, nrows = Inf, skip = 0, header = TRUE, col.names = NULL, include_filename = FALSE, show_progress = FALSE, ...) {
require(data.table)
# Ensure data.table is available
if (!requireNamespace("data.table", quietly = TRUE)) {
stop("The 'data.table' package is required but not installed. Please install it via install.packages('data.table').")
}
if (is.null(include_filename)) {
include_filename <- FALSE
}
if((is.null(files)) & !is.null(path)){
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
}
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
tryCatch(expr = dat <- fread(cmd = cmd, header = F), finally = data.table())
if(dat[, .N == 0]){
dat <- shallow.copy[-c(1:.N),]
}
# Handles all names except V1, which is addressed after potentially splitting columns downstream.
setnames(x = dat, old = names(dat), new = c("V1", names(shallow.copy)[2:ncol(shallow.copy)]), skip_absent = TRUE)
# Split first column if metadata is included.
if(need_metadata == TRUE & dat[, .N > 0]){
column.names <- c(c("file", "line_number")[c((include_filename == T | length(files > 1)), show_line_numbers == T)], names(shallow.copy)[1])
additional.columns = split.columns(x = dat[, V1], column.names = column.names, resulting.columns = length(column.names))
dat <- data.table(dat, additional.columns)
dat[, V1 := NULL]
setcolorder(x = dat, neworder = names(shallow.copy), skip_absent = T)
if(include_filename == FALSE & "file" %in% names(dat)){
dat[, file := NULL]
}
if(show_line_numbers == FALSE & "line_number" %in% names(dat)){
dat[, line_number := NULL]
}
}
if(need_metadata == FALSE){
setnames(x = dat, old = "V1", new = names(shallow.copy)[1], skip_absent = TRUE)
}
header_contains_pattern <- length(grep(pattern = pattern, x = names(dat))) > 0
# Remove header rows
if(header == TRUE){
if((pattern == "") | (pattern != "" & header_contains_pattern == TRUE)){
num.files <- length(files)
if(num.files == 1){
dat <- dat[2:.N,]
}
if(num.files > 1){
counts <- grep_count(files = files, path = path, file_pattern = file_pattern, pattern = pattern, invert = invert, ignore_case = ignore_case, fixed = fixed, recursive = recursive, word_match = word_match, only_matching = only_matching, skip = skip, header = header)
dat <- dat[-c(1, 1 + counts[1:(.N-1), cumsum(1 + count)])]
}
}
}
if(header == TRUE & "line_number" %in% names(dat)){
dat[, line_number := as.numeric(line_number) - 1]
}
# Restore original data types
data.types <- as.data.table(x = t(shallow.copy[, lapply(X = .SD, FUN = "class")]), keep.rownames = TRUE)
unique.types <- data.types[V1 != "character", unique(V1)]
if(length(unique.types) > 0){
for(i in 1:length(unique.types)){
dat[, names(.SD) := lapply(X = .SD, FUN = "as", Class = unique.types[i]), .SDcols = data.types[V1 == unique.types[i], rn]]
}
}
# Limit rows if nrows < .N
dat <- dat[1:min(c(.N, nrows)),]
# return data
return(dat[])
}
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "VVS")
pattern
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
tryCatch(expr = dat <- fread(cmd = cmd, header = F), finally = data.table())
if(dat[, .N == 0]){
dat <- shallow.copy[-c(1:.N),]
}
dat
grep_read <- function(files = NULL, path = NULL, file_pattern = NULL, pattern = "", invert = FALSE, ignore_case = FALSE, fixed = FALSE, show_cmd = FALSE, recursive = FALSE, word_match = FALSE, show_line_numbers = FALSE, only_matching = FALSE, nrows = Inf, skip = 0, header = TRUE, col.names = NULL, include_filename = FALSE, show_progress = FALSE, ...) {
require(data.table)
# Ensure data.table is available
if (!requireNamespace("data.table", quietly = TRUE)) {
stop("The 'data.table' package is required but not installed. Please install it via install.packages('data.table').")
}
if (is.null(include_filename)) {
include_filename <- FALSE
}
if((is.null(files)) & !is.null(path)){
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
}
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
tryCatch(expr = dat <- fread(cmd = cmd, header = F), finally = data.table())
if(dat[, .N == 0]){
dat <- shallow.copy[-c(1:.N),]
return(dat)
}
# Handles all names except V1, which is addressed after potentially splitting columns downstream.
setnames(x = dat, old = names(dat), new = c("V1", names(shallow.copy)[2:ncol(shallow.copy)]), skip_absent = TRUE)
# Split first column if metadata is included.
if(need_metadata == TRUE){
column.names <- c(c("file", "line_number")[c((include_filename == T | length(files > 1)), show_line_numbers == T)], names(shallow.copy)[1])
additional.columns = split.columns(x = dat[, V1], column.names = column.names, resulting.columns = length(column.names))
dat <- data.table(dat, additional.columns)
dat[, V1 := NULL]
setcolorder(x = dat, neworder = names(shallow.copy), skip_absent = T)
if(include_filename == FALSE & "file" %in% names(dat)){
dat[, file := NULL]
}
if(show_line_numbers == FALSE & "line_number" %in% names(dat)){
dat[, line_number := NULL]
}
}
if(need_metadata == FALSE){
setnames(x = dat, old = "V1", new = names(shallow.copy)[1], skip_absent = TRUE)
}
header_contains_pattern <- length(grep(pattern = pattern, x = names(dat))) > 0
# Remove header rows
if(header == TRUE){
if((pattern == "") | (pattern != "" & header_contains_pattern == TRUE)){
num.files <- length(files)
if(num.files == 1){
dat <- dat[2:.N,]
}
if(num.files > 1){
counts <- grep_count(files = files, path = path, file_pattern = file_pattern, pattern = pattern, invert = invert, ignore_case = ignore_case, fixed = fixed, recursive = recursive, word_match = word_match, only_matching = only_matching, skip = skip, header = header)
dat <- dat[-c(1, 1 + counts[1:(.N-1), cumsum(1 + count)])]
}
}
}
if(header == TRUE & "line_number" %in% names(dat)){
dat[, line_number := as.numeric(line_number) - 1]
}
# Restore original data types
data.types <- as.data.table(x = t(shallow.copy[, lapply(X = .SD, FUN = "class")]), keep.rownames = TRUE)
unique.types <- data.types[V1 != "character", unique(V1)]
if(length(unique.types) > 0){
for(i in 1:length(unique.types)){
dat[, names(.SD) := lapply(X = .SD, FUN = "as", Class = unique.types[i]), .SDcols = data.types[V1 == unique.types[i], rn]]
}
}
# Limit rows if nrows < .N
dat <- dat[1:min(c(.N, nrows)),]
# return data
return(dat[])
}
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "VVS")
this = grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "VVS")
this
grep_read <- function(files = NULL, path = NULL, file_pattern = NULL, pattern = "", invert = FALSE, ignore_case = FALSE, fixed = FALSE, show_cmd = FALSE, recursive = FALSE, word_match = FALSE, show_line_numbers = FALSE, only_matching = FALSE, nrows = Inf, skip = 0, header = TRUE, col.names = NULL, include_filename = FALSE, show_progress = FALSE, ...) {
require(data.table)
# Ensure data.table is available
if (!requireNamespace("data.table", quietly = TRUE)) {
stop("The 'data.table' package is required but not installed. Please install it via install.packages('data.table').")
}
if (is.null(include_filename)) {
include_filename <- FALSE
}
if((is.null(files)) & !is.null(path)){
files <- list.files(path = path, pattern = file_pattern, full.names = TRUE, recursive = recursive, ignore.case = ignore_case)
}
if(is.na(pattern)){
pattern <- ""
}
need_metadata <- (show_line_numbers == T) | (include_filename == T) | (length(files) > 1)
options <- c("-v", "-i", "-F", "-r", "-w", "-n", "-o", "-H")[c(invert, ignore_case, fixed, recursive, word_match, show_line_numbers, only_matching, need_metadata)]
options_str <- paste(options, collapse = " ")
cmd <- build_grep_cmd(pattern = pattern, files = files, options = options_str, fixed = fixed)
if(show_cmd == TRUE){
return(cmd)
}
# Set an artificial header of V1, V2, etc.
shallow.copy <- fread(input = files[1], nrows = 10)
tryCatch(expr = dat <- fread(cmd = cmd, header = F), finally = data.table())
if(dat[, .N == 0]){
dat <- shallow.copy[-c(1:.N),]
return(dat[])
}
# Handles all names except V1, which is addressed after potentially splitting columns downstream.
setnames(x = dat, old = names(dat), new = c("V1", names(shallow.copy)[2:ncol(shallow.copy)]), skip_absent = TRUE)
# Split first column if metadata is included.
if(need_metadata == TRUE){
column.names <- c(c("file", "line_number")[c((include_filename == T | length(files > 1)), show_line_numbers == T)], names(shallow.copy)[1])
additional.columns = split.columns(x = dat[, V1], column.names = column.names, resulting.columns = length(column.names))
dat <- data.table(dat, additional.columns)
dat[, V1 := NULL]
setcolorder(x = dat, neworder = names(shallow.copy), skip_absent = T)
if(include_filename == FALSE & "file" %in% names(dat)){
dat[, file := NULL]
}
if(show_line_numbers == FALSE & "line_number" %in% names(dat)){
dat[, line_number := NULL]
}
}
if(need_metadata == FALSE){
setnames(x = dat, old = "V1", new = names(shallow.copy)[1], skip_absent = TRUE)
}
header_contains_pattern <- length(grep(pattern = pattern, x = names(dat))) > 0
# Remove header rows
if(header == TRUE){
if((pattern == "") | (pattern != "" & header_contains_pattern == TRUE)){
num.files <- length(files)
if(num.files == 1){
dat <- dat[2:.N,]
}
if(num.files > 1){
counts <- grep_count(files = files, path = path, file_pattern = file_pattern, pattern = pattern, invert = invert, ignore_case = ignore_case, fixed = fixed, recursive = recursive, word_match = word_match, only_matching = only_matching, skip = skip, header = header)
dat <- dat[-c(1, 1 + counts[1:(.N-1), cumsum(1 + count)])]
}
}
}
if(header == TRUE & "line_number" %in% names(dat)){
dat[, line_number := as.numeric(line_number) - 1]
}
# Restore original data types
data.types <- as.data.table(x = t(shallow.copy[, lapply(X = .SD, FUN = "class")]), keep.rownames = TRUE)
unique.types <- data.types[V1 != "character", unique(V1)]
if(length(unique.types) > 0){
for(i in 1:length(unique.types)){
dat[, names(.SD) := lapply(X = .SD, FUN = "as", Class = unique.types[i]), .SDcols = data.types[V1 == unique.types[i], rn]]
}
}
# Limit rows if nrows < .N
dat <- dat[1:min(c(.N, nrows)),]
# return data
return(dat[])
}
this
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "VVS")
help("tryCatch")
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "3")
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "1Bj")
grep_read(path = "~/Downloads/data sets/", recursive = T, pattern = "1Bj", include_filename = T)
q('no')
