Skip to contents

Data wrangling

Functions for performing common data wrangling procedures.

Data Import

Functions for working with data files.

smart_read()
Read a data file
read_dictionary() print(<dictionary>) `[`(<dictionary>) apply_dictionary() has_dictionary() get_dictionary()
Data Dictionaries
read_meta()
Read CSV with iNZight metadata
read_text()
Read text as data
load_linked()
Import linked data into an inzdf object
load_rda()
Load object(s) from an Rdata file
save_rda()
Save an object with, optionally, a (valid) name
sheets()
List available sheets within a file
inzdf()
iNZight data frame object

Dataset operations

Methods for working with entire datasets at once. For users coming from the iNZight GUI, these operations would be found in the Dataset menu.

aggregate_data() aggregate_dt()
Aggregate data by categorical variables
append_rows()
Append rows to a dataset
remove_rows()
Remove rows from data by row numbers
filter(<inzdf_db>)
Filter
filter_cat()
Filter data by levels of categorical variables
filter_num()
Filter data by levels of numeric variables
join_data()
Join data with another dataset
separate_var()
Separate columns
reshape_data()
Reshaping dataset from wide to long or from long to wide
combine_vars()
Combine variables into one categorical variable
select_vars()
Select variables from a dataset
sort_vars()
Sort data by variables
select
Select
validation_details()
Details of Validation Rule Results
validation_summary()
Validation Confrontation Summary

Variable operations

Methods for working with one or several variables (columns) in a dataset. iNZight GUI users will be familiar with these operations from the Variables menu.

collapse_cat()
Collapse data by values of a categorical variable
convert_to_cat()
Convert variables to categorical variables
convert_to_date()
Convert variables to dates
convert_to_datetime()
Convert variables to date-time
create_vars()
Create new variables
delete_vars()
Delete variables
extract_dt_comp()
Extract date component from a date-time variable
extract_part()
Extract part of a datetimes variable (DEPRECATED)
form_class_intervals()
Form Class Intervals
missing_to_cat()
Convert missing values to categorical variables
rank_vars()
Rank the data of numeric variables
rename_levels()
Rename the levels of a categorical variable
rename_vars()
Rename column names
reorder_levels()
Reorder the levels of a categorical variable
standardize_vars()
Standardize the data of a numeric variable
transform_vars()
Transform data of numeric variables

Working with data in R

Code writing

Functions for accessing and working with code returned by iNZightTools functions.

code()
Get Data's Code
print_code()
Tidy-printing of the code attached to an object
tidy_all_code()
iNZight Tidy Code

Working with dataset objects in R

Many of these functions are only useful in scripts, and are provided more for GUIs that R users.

add_suffix()
Add suffix to string
create_varname()
Create variable name
make_names()
Make unique variable names

Helper functions

A set of helper functions for checking variable types and reducing code elsewhere.

is_cat()
Is factor check
is_dt()
Is datetime check
is_num()
Is numeric check
is_preview()
Is Preview
is_survey()
Check if object is a survey object (either standard or replicate design)
is_svydesign()
Check if object is a survey object (created by svydesign())
is_svyrep()
Check if object is a replicate survey object (created by svrepdesign())
vartype()
Get variable type name
vartypes()
Get all variable types from data object
`%notin%`
Anti value matching
`%||%`
NULL or operator
survey_IQR()
Interquartile range function for surveys

Other wrapper functions

fitModel()
Fit models
fitDesign()
Fit a survey design
newdevice()
Open a New Graphics Device
random_sample()
Random sampling without replacement