-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport_labels example.Rmd
45 lines (27 loc) · 1.78 KB
/
import_labels example.Rmd
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "import_labels example"
author: "Jordan Prendez"
date: "`r Sys.Date()`"
output: word_document
vignette: >
%\VignetteIndexEntry{Vignette Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
The import_labels function is meant to to import SPSS ® style labels and attach them to a dataset in R.
Currently both the dataset and the definitions must be external files (i.e. files located on a local drive --not those already loaded into R)
##Dataset format
the import labels command accepts datasets with the variable in the the first row. Data values follow in each subsequent row. Values should be comma seperated and saved in a .txt file.
###Dataset format example
![Dataset format example](C:\Users\jprendez\Documents\inst.research\dataset.jpg)
the import labels command accepts definitions with the level of the variable (either string or numeric) followed by the variable definition. Levels that are strings must be surrounded by single quotes ''.
Each new variable should start with a forward slash "/" (no quotes) and must match the variable name in the dataset (case sensitive)
![definition format example](C:\Users\jprendez\Documents\inst.research\definitions.jpg)
https://bitbucket.org/nietsnel/inst.research/src/a2a25913c8d1f94e7815bcfccf3551d8c9bc78e7/import_labels_example.html?at=master&fileviewer=file-view-default
##Running the program Example
dataset=path of the dataset file (with formating shown above)
dataset=path of the definition file (with formating shown above)
import_labels(dataset="C:/Users/jprendez/Desktop/ic2015.csv", definitions="C:/Users/jprendez/Desktop/definitions.txt")
Also a quote using `>`:
> "He who gives up [code] safety for [code] speed deserves neither."
([via](https://twitter.com/hadleywickham/status/504368538874703872))