Description Usage Arguments Details Value Examples
Count the number of columns for each variable found in Excel data file
1 | ncols_by_variable(data.xls)
|
data.xls |
is the output data frame from |
This function is used to check whether the number of columns in
each variable in the Excel file are the same for the same data type (1 or 2).
It used as input the output of the function xls_read
.
This identifies non-standard files of data arrangement.
data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
if(interactive()){
library(stringr)
xfiles_l <- list.files("vignettes/dvd_xls_files", recursive = TRUE, full.names = TRUE)
fpath <- basename(xfiles_l)
length(xfiles_l)
# select file 2
sel <- str_detect(fpath, ".*_(\\S|\\s)\\.xls\\.xls") |
str_detect(fpath, ".*[:punct:]_\\.xls") |
str_detect(fpath, ".*[A-z]{1}_\\.xls\\.xls") |
str_detect(fpath, ".*[A-z]{1}_V\\.xls\\.xls")
length(xfiles_l[sel])
# verficação dos arquivos 2 (outras variáveis)
data_l <- lapply(xfiles_l[sel], function(ifile) xls_read(file.xls = ifile))
# check num od columns by variable
ncol_vars <- plyr::ldply(l, function(x) {
cat(attr(x, "meta")[["id"]], "\n")
ncols_by_variable(x)
})
head(ncol_vars)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.