import_data: Import Raw Data Into the Project

View source: R/start.R

import_dataR Documentation

Import Raw Data Into the Project

Description

Import Raw Data Into the Project

Usage

import_data(dir, modlist = NULL, state, filetype, ..., na.strings, db = NULL)

read_in_excel_data(
  dir,
  state,
  filetype,
  drop.c = NULL,
  drop.v = NULL,
  nvars = NULL,
  na.strings = ""
)

Arguments

dir

A directory used for the downloads, which usually has subdirectories - one for each project State.

modlist

An optional list of objects of class VarModifier.

state

The project state.

filetype

The kind of data being imported. Should be one of Capacity or Services for data on capacity assessment and for GBV service mapping, respectively.

...

Arguments passed to read_in_excel_data.

na.strings

Strings in the Excel sheet to be interpreted as MA.

db

Path to an SQLite database. If non-existent, will attempt to create one. If NULL, the data are returned without being saved.

drop.c, drop.v

Character or integer vector of columns or variables to be dropped from the data table or list of variable names, respectively.

nvars

The number of columns in the final data frame.

Value

Both functions return a data.frame with labelled variables. import_data does so invisibly.

Note

import_data wraps read_in_excel_data, as it carries out additional processing of the data read from the spreadsheets. nvars is usually set for the capacity assessment data, which tend to have superfluous columns.


BroVic/jGBV documentation built on Oct. 9, 2022, 6:38 a.m.