Unlimited learning, half price | 50% off
Get 50% off unlimited learning

BeeBDC (version 1.2.0)

ColTypeR: Sets up column names and types

Description

This function uses readr::cols_only() to assign a column name and the type of data (e.g., readr::col_character(), and readr::col_integer()). To see the default columns simply run ColTypeR(). This is intended for use with readr::read_csv(). Columns that are not present will NOT be included in the resulting tibble unless they are specified using ....

Usage

ColTypeR(...)

Value

Returns an object of class col_spec. See readr::as.col_spec() for additional context and explication.

Arguments

...

Additional arguments. These can be specified in addition to the ones default to the function. For example:

Examples

Run this code
  # You can simply return the below for default values
  library(dplyr)
BeeBDC::ColTypeR() 

  # To add new columns you can write
ColTypeR(newCharacterColumn = readr::col_character(), 
         newNumericColumn = readr::col_integer(), 
         newLogicalColumn = readr::col_logical()) 

# Try reading in one of the test datasets as an example:
beesFlagged %>% dplyr::as_tibble(col_types = BeeBDC::ColTypeR())
  # OR
beesRaw %>% dplyr::as_tibble(col_types = BeeBDC::ColTypeR())


Run the code above in your browser using DataLab