typemix: Check the mixture of data types

Description Usage Arguments Value Examples

Description

The function helps to find the columns in a data frame that contains different types of data. R has 6 atomic vector types. The function roughly identifies if an observation belongs to one of the 3 main data types, number, logical, and character. Note, the self-defined type "number" here is an assemble of types including numeric (real and decimal), integer and complex.

Usage

1

Arguments

df

a data frame

Value

A list of 3 data frames. First one is the input data frame, the second one has the same dimension as the first one, but has corresponding data type marked in the cells of the columns where mixture status is found. The third data frame is the summary of result, with ID of the columns as row names and the 3 data types as headers. It tells us the total number of each data type found in each column where mixture is found.

Examples

1
2
3
4
5
6
7
8
9
# sample data frame
sample_df<-data.frame(x1=c(1,2,3,"1.2.3"),
                   x2=c("test","test",TRUE,100),
                   x3=c(1,FALSE,"FALSE "," true"),
                   x4=c(1,2,3,4),
                   x5=c("t","t","t","t"),
                   x6=c(TRUE,TRUE,FALSE,FALSE))

typemix(sample_df)

UBC-MDS/tidyplusR documentation built on May 25, 2019, 1:36 p.m.