Learn R Programming

⚠️There's a newer version (0.9.1) of this package.Take me there.

output: github_document

incadata

The goal of incadata is to provide basic functionality to handle data from INCA and the Regional cancer centers in Sweden.

Installation

You can install the released version of incadata from CRAN with:

install.packages("incadata")

And the development version from BitBucket with:

# install.packages("devtools")
devtools::install_bitbucket("cancercentrum/incadata")

Standardised data sets

The function as.incadata standardize data from INCA and Rockan:

  • All date formats used by Rockan are recognized as dates and coerced to such (for example: 1985-05-04, "", 19850504, 19850500

, 19850000 and 8513).

  • Booleans are numeric vectors in INCA: c(0, 1, 0, 1, 0, 0), but coerced to character when exported: c(NA, "True", NA, "True", NA, NA). The package recognise this

peculiarity and coerce to Boolean.

  • Personal identity numbers are recognised even if they end with "X" etcetera (used in Rockan).
  • Standard numerical codes from Rockan are decoded (using the decoder package).
  • Column names are always coerced to lower case, since these are generally easier to work with.
  • Data frames are coerced to tibbles .
  • An id column is always added to data frames in order to always have an identification variable at hand (regardless if the data has none or one of "PERSNR", "PNR" or "PAT_ID")

Register documentation

The package also provides functionality for easier access and archiving of register documentation (se vignette "incadoc") and function documents.

Additional functionality

The package also lets you ...

  • ... cache your data sets between work sessions in on order to speed up the data loading and munging process
  • ... use a single data reading/munging function regardless if you work on INCA or locally
  • ... interactively engage in the coercing process of variable formats. This is handy for example if a variable is almost a date but has some additional entries that are not recognised as such.

Code of conduct

Please note that the 'incadata' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('incadata')

Monthly Downloads

26

Version

0.8.2

License

GPL-2

Maintainer

Erik Bulow

Last Published

May 5th, 2019

Functions in incadata (0.8.2)

is.inca

Check if R is running from INCA
is.incalogical

Coerce to logical if value is logical according to INCA
find_documents

List URLS to documents for a register
find_links

Find links from web page
as.incadata

Identify data formats used by INCA and Rockan
id

Add id variables to data frame
next_method

Function to create methods for generics
find_register

Find register by name
psum

Parallel sum
reexports

Objects exported from other packages
use_incadata

Use incadata from file or dataframe df
exceed_threshold

Check if transformation/coercing of a vector is good enough
lt

Lead time from one date to another
lownames

Make all names in data.frame lower case
exportr

Dump script together with functions from required packages
specify_missing

Specify missing values for a vector
is.wholenumber

Test if a numeric vector consists of whole numbers
is.scalar_in

Test if scalar is in interval
width

Calculate the width of the range of x
clean_text

Clean/standardize text
as_numeric

Test object for, or coerce to, numeric
create_s3_method

Template functions to generate basic S3 methods for new classes
dplyr_methods

dplyr methods for INCA data
ex_data

Synthetic example data from INCA
best_match

Tries to correct misspelling of character string
cut.integer

Convert integer vector to Factor
documents

Download and possibly open INCA documentation
as.Dates

Converting potential date to Date vector