guess_data_types: Guess data types

View source: R/guess_data_types.R

guess_data_typesR Documentation

Guess data types

Description

This function removes any columns where there is no data and makes guesses on the data type. However, this relies on the data not being coded already. If the data has been coded, the metadata generated can be used as a template that can be modified and provided as input for process_data.

Usage

guess_data_types(data_file_path)

Arguments

data_file_path

The path for the data file where guessing the data types of columns is necessary.

Value

outcome

Whether the operation was successfully performed

message

Any information, particularly when the operation fails.

data

The data after removing the columns without any data.

metadata

Automated metadata is created based on the data. However, this relies on data not previously coded, for example, if the status is coded as 0 and 1 rather than 'absent' and 'present', the variable will be recognised as a quantitative variable rather than categorical variable.

any_type

All fields with data.

quantitative

Fields recognised as quantitative.

numerical

Fields recognised as continuous.

count

Fields recognised as count. Count data is recognised from the field name. If a field name starts with 'Number of', it is considered as count data.

categorical

Fields recognised as categorical data.

nominal

Fields recognised as nominal data. All categorical data with more than two levels are recognised as nominal data.

binary

Fields recognised as binary data. All categorical data with only two levels are recognised as binary data.

ordinal

Fields recognised as ordinal data. Any categorical data with more than two levels and with the second character of all the levels being an '_' are recognised as ordinal data.

date

Fields recognised as date.

time

Fields recognised as time.

Author(s)

Kurinchi Gurusamy

See Also

process_data

Examples

data_file_path <- paste0(tempdir(), "/df.csv")
write.csv(penguins, data_file_path, row.names = FALSE, na = "")
guessed_data_types <- guess_data_types(data_file_path = data_file_path)
guessed_data_types

EQUALPrognosis documentation built on Feb. 4, 2026, 5:15 p.m.