ModuleImportServer: The server function of the CSV import module

View source: R/ImportModule.R

ModuleImportServerR Documentation

The server function of the CSV import module

Description

The server function of the CSV import module

Usage

ModuleImportServer(
  Id,
  Mode = .ImpModes,
  ColSpec = NULL,
  FileSpec = NULL,
  Options = NULL
)

Arguments

Id

Module name space

Mode

Interaction mode of the module. What possibilities shall the user have to modify the way the file is to be imported? One of three options: "AsIs", "Desired", "UserDefined".

ColSpec

A list specifying the columns to import.

FileSpec

A list describing the expected CSV format. (see details).

Options

Use Options$UILang for the language in the user interface (allowed values: "en", "de").

Details

ColSpec can have different formats. It can be a col_spec object (see readr::cols_condense()), a tibble or a named list with the following format:

Name

A list of variable (i.e. column) names that shall replace the column heads in the file (character vector).

NameInFile

A list of column heads in the CSV file (character vector).

Type

The data types of each variable (character vector). If no value (i.e. falsy values) is given, it will be guessed.

Format

An additional format specification (character vector). That is supported by "datetime", "date", and "time". If none is given the Expected options are used.

FileSpec can have these fields:

LangCode

Language code (e.g. "de" or "en)

Header

Does the CSV file have a header? (TRUE (default)/FALSE; see utils::read.csv() argument header). If a column specification is available, Header will be coerced to TRUE.

ColSep

A character separating columns ( see utils::read.csv() argument sep)

ThousandsSep

The character that separates thousands in numbers.

DecimalsSep

The character used decimal points in the file (see utils::read.csv() argument dec)

DateFormat

Format used for dates in the file (format specification by base::strptime()).

TimeFormat

Format used for temporal data in the file (format specification by base::strptime()).

Quote

Character to identify text, see utils::read.csv() argument quote

StringsAsFactors

Convert all strings to factors (TRUE/FALSE is default; see utils::read.csv() argument stringsAsFactors).

Value

A data frame containing the uploaded CSV file


SigurdJanson/shinyCSVImpoMod documentation built on Jan. 5, 2023, 3:57 a.m.