bad_database: Bad database to test vartors

Description Format Details See Also Examples

Description

A small dataset randomly generated to simulate an hypothetical survey and test vartors.

Format

A data.frame with 100 rows and 10 variables

Details

Include multiple definitions for NA's and not meaningful variables. It's a typical example of database we have to process. This database is close to example_df but more realistic because includes more typing errors. It is used in the vignette tutorial. This dataset was generated with the function simulate_dataframe from the package dfexplore, wrote in a csv file, altered to add errors and imported in R with read.csv.

The columns are :

subject

An integer. Unique number of the subject.

initial

A factor. Initials of the subject. Recognised as a factor by read.csv instead of a character vector.

birth

A factor. Birthdate. Recognized as a factor by read.csv instead of a date.

sex

A factor with levels male female

study_level

A factor with levels primary < secondary < superior but recognized as a simple factor instead of a oredered factor.

heigh

A factor. Recognized as a factor by read.csv instead of a numeric because there are multiple definitions for NA

weight

A factor. Recognized as a factor by read.csv instead of a numeric because there are multiple definitions for NA

siblings

A factor. Recognized as a factor by read.csv instead of a an integer because there are multiple definitions for NA

Q1

An integer. Question 1. Without further description, we can't guess what's the meaning of this variable.

Q2

An integer. Question 2. Without further description, we can't guess what's the meaning of this variable.

See Also

variables_description_bad_database is an example of variable description table for this database.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# See the class of each variable
str(bad_database)

# Create a variable description table skeleton
descvar_baddb <- descvars_skeleton(bad_database)

# Edit the variable description table
## Not run: 
variables_description_bad_database <- edit(descvar_baddb)

## End(Not run)

# Watch the variable description table after editing
variables_description_bad_database

# Use it to create a script to import bad_database
myscript <- create_script(variables_description_bad_database)
## Not run: 
# Show the script
myscript

# Write the script in a file
write_file(myscript, "my_import_script.R")

## End(Not run)

jomuller/vartors documentation built on May 19, 2019, 7:26 p.m.