import_txt_files_inmet: Import raw data files of automatic stations

Description Usage Arguments Value Examples

Description

Import raw data files of automatic stations

Usage

1
2
import_txt_files_inmet(files, verbose = TRUE, only.problems = FALSE,
  full.names = FALSE)

Arguments

files

character vector with path to files

verbose

logical scalar. If TRUE, print messages and warnings.

only.problems

logical value. Set TRUE to return a tibble with problems information on file and FALSE to return meteorological data.

full.names

a logical value. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned.

Value

A data frame with one row for each problem and four columns:

row,col

Row and column of problem

expected

What readr expected to find

actual

What it actually got

file

file name or the path to file (if full.names is TRUE)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(dplyr); library(purrr); library(stringr); library(readr)
# missing columns problem example
myfile <- system.file("extdata", "A838.txt", package = "inmetwrangler")
myfile
 A838_problems <- import_txt_files_inmet(files = myfile, 
                                         verbose = TRUE, 
                                         only.problems = TRUE)
 A838_data <- import_txt_files_inmet(files = myfile, 
                                     verbose = TRUE, 
                                     only.problems = FALSE)
#looking at rows
for(irow in A838_problems$row) read_lines(myfile, skip = irow-2, n_max = irow+2)
# View(slice(A838_data, A838_problems$row)) #  columns filled with NAs

lhmet/inmetwrangler documentation built on May 15, 2019, 1:42 p.m.