Description Usage Arguments Value Author(s) Examples
View source: R/descvars_skeleton.R
Create a definition of variables table skeleton in a data.frame from a database. Basically, this function gets the header of the database, puts it in the column "originalname", gets the type and put them in "type", adds column "spreadsheet column letter" and all the others columns to have a definition of variables table.
1 | descvars_skeleton(database, factor_detect = 6, rname_size = 0)
|
database |
A data.frame with the data imported for example with |
factor_detect |
An integer. If the number of unique value in a variable is below this threshold, then it will be considered as a factor |
rname_size |
An integer. The maximal size for an rname. If is 0, then will not shorten the original name. |
Return a data.frame
. This data.frame
could be used as a skeleton of descvar, for example exporting it in a file with write.csv
or write.xlsx
Joris Muller
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Import a database
data(example_df)
head(example_df)
# Create a skeleton of DatabaseDef from this database
descvars_sk <- descvars_skeleton(example_df)
descvars_sk[,1:10]
# This skeleton could be written on the disk in csv
# to be completed later in a spreadsheet sofware
## Not run:
write.csv(descvars_sk, file="Variables_description.csv")
## End(Not run)
# or in Excel
## Not run:
libary(openxslx)
write.xlsx(descvars_sk, file="Variables_description.xlsx")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.