Package: labelr 0.1.8

Robert Hartman

labelr: Label Data Frames, Variables, and Values

Create and use data frame labels for data frame objects (frame labels), their columns (name labels), and individual values of a column (value labels). Value labels include one-to-one and many-to-one labels for nominal and ordinal variables, as well as numerical range-based value labels for continuous variables. Convert value-labeled variables so each value is replaced by its corresponding value label. Add values-converted-to-labels columns to a value-labeled data frame while preserving parent columns. Filter and subset a value-labeled data frame using labels, while returning results in terms of values. Overlay labels in place of values in common R commands to increase interpretability. Generate tables of value frequencies, with categories expressed as raw values or as labels. Access data frames that show value-to-label mappings for easy reference.

Authors:Robert Hartman [aut, cre], The MITRE Corporation [cph]

labelr_0.1.8.tar.gz
labelr_0.1.8.zip(r-4.5)labelr_0.1.8.zip(r-4.4)labelr_0.1.8.zip(r-4.3)
labelr_0.1.8.tgz(r-4.4-any)labelr_0.1.8.tgz(r-4.3-any)
labelr_0.1.8.tar.gz(r-4.5-noble)labelr_0.1.8.tar.gz(r-4.4-noble)
labelr_0.1.8.tgz(r-4.4-emscripten)labelr_0.1.8.tgz(r-4.3-emscripten)
labelr.pdf |labelr.html
labelr/json (API)
NEWS

# Install 'labelr' in R:
install.packages('labelr', repos = c('https://rhartmano.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/rhartmano/labelr/issues

On CRAN:

5.76 score 3 stars 10 scripts 341 downloads 131 exports 0 dependencies

Last updated 3 months agofrom:757dea25dd. Checks:OK: 5 ERROR: 2. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 18 2024
R-4.5-winERRORNov 18 2024
R-4.5-linuxERRORNov 18 2024
R-4.4-winOKNov 18 2024
R-4.4-macOKNov 18 2024
R-4.3-winOKNov 18 2024
R-4.3-macOKNov 18 2024

Exports:add_factor_infoadd_frame_labadd_lab_attsadd_lab_col1add_lab_colsadd_lab_dumm1add_lab_dummiesadd_m1_labadd_name_labsadd_quant_labsadd_quant1add_val_labsadd_val1add1m1adfadf2aflalbalcalc1aldald1aldfall_quant_labsall_uniquevall_univallqam1lanlaqlaql1as_base_data_frameas_base_data_frame2as_labeled_data_frameas_numas_numvavlavl1axis_labcheck_any_lab_attscheck_classcheck_irregularcheck_labs_attclean_data_attsconvert_labscopy_vardfldnldrop_frame_labdrop_name_labsdrop_val_labsdrop_val1dvldvl1f2cf2intfact2charfactor_to_lab_intflabget_all_factorsget_all_lab_attsget_factor_attsget_factor_infoget_frame_labget_labs_attget_name_labsget_val_lab1get_val_labsgflgnlgremlgremlrgvlgvl1h11lhas_avl_labshas_decvhas_m1_labshas_quant_labshas_val_labsheadlhm1lhqlhvlinit_labsint2firregular2irregular2vis_numablelab_int_to_factormake_demo_datamake_likert_datarecode_valsrestore_factor_infosbracscbindschangesdropsfiltersgenslabsmergesomelsort_val_labssrbindsrenamesreplacesselectssortssubsetstrip_labstabltailltransfer_labsunluse_name_labsuse_val_lab1use_val_labsuse_var_namesuvluvl1uvnvval_labs_vecvlvwblwith_both_labswith_name_labswith_val_labswnlwvl

Dependencies:

Labelr - An Introduction

Rendered fromlabelr-introduction.Rmdusingknitr::rmarkdownon Nov 18 2024.

Last update: 2024-07-19
Started: 2024-02-13

Labelr - Special Topics

Rendered fromlabelr-special-topics.Rmdusingknitr::rmarkdownon Nov 18 2024.

Last update: 2024-08-30
Started: 2024-02-13

Readme and manuals

Help Manual

Help pageTopics
Add Factor-specific Attributes to a Data Frameadd_factor_info
Add or Modify a Data Frame "Frame Label"add_frame_lab afl
Add labelr Attributes from a list to a Data Frameadd_lab_atts
Create a Value Labels Column for a Single Variable and Add to the Data Frameadd_lab_col1 alc1
Add Variable Value Label Columns to a Data Frameadd_lab_cols alc
Add A Dummy Variable for Each Value Label of a Single Variableadd_lab_dumm1 ald1
Add A Dummy Variable for Each Value Labeladd_lab_dummies ald
Apply One Label to Multiple Valuesadd_m1_lab am1l
Add or Modify Data Frame Variable Name Labelsadd_name_labs anl
Associate Numerical Threshold-based Value Labels with Select Numerical Variablesadd_quant_labs aql
Associate Numerical Threshold-based Value Labels with a Single Numerical Variableadd_quant1 aql1
Add or Modify a Variable's Value Labelsadd_val_labs avl
Add or Modify a Single Variable's Value Labelsadd_val1 avl1
Apply One Label to Multiple Values for a Single Variableadd1m1
Add Quantile-based Value Labels to All Numeric Vars that Meet Specificationsallq all_quant_labs
Are All Values in a Free-standing Vector Unique?all_uniquev all_univ
Convert Augmented Data Frame to Base R Data Frameadf as_base_data_frame
Convert Augmented Data Frame to Base R Data Frame with Alternate Defaultsadf2 as_base_data_frame2
Assign Class labeled.data.frame to a Data Frame Objectaldf as_labeled_data_frame
Convert all Suitable Character Variables to Numericas_num
Convert a Suitable Character Vector to Numericas_numv
Retrieve Variable's Name Label for Plot Labelingalb axis_lab
Check Whether Data Frame Has Any labelr Attributescheck_any_lab_atts
Determine If Vector Belongs to Any of Specified Classescheck_class
Check Vector for "Irregular" Valuescheck_irregular
Check Data Frame for Specified labelr Attributecheck_labs_att
"Clean" Data Frame Attributesclean_data_atts
Convert from Haven-style to labelr Variable Value Labelsconvert_labs
Copy a Data Frame Variable and its Value labels to Another Variablecopy_var
Remove Frame Label Attribute from a Data Framedfl drop_frame_lab
Remove Name Label Attributes from a Data Framednl drop_name_labs
Drop Value Labels from One or More Variablesdrop_val_labs dvl
Drop a Single Variable's Value Labelsdrop_val1 dvl1
Convert All Factor Variables of a Data Frame to Character Variablesf2c fact2char
Convert a Factor Variable Column to Value-labeled Integer Variable Columnf2int factor_to_lab_int
Filter Data Frame Rows Using Variable Value Labelsflab
Put Data Frame Factor Level Information into a Listget_all_factors
Put all Data Frame label attributes into a Listget_all_lab_atts
Get Factor Attributes from a Labeled Data Frameget_factor_atts
Return Factor Attributes as a Data Frameget_factor_info
Return a Data Frame's Frame Labelget_frame_lab gfl
Return Specified Label Attribute, if Presentget_labs_att
Return Look-up Table of Variable Names and Name Labelsget_name_labs gnl
Return Look-up Table of One Variable's Value Labelsget_val_lab1 gvl1
Return Look-up Table of Variable Values and Value Labelsget_val_labs gvl
Determine Which Pattern Elements of One Character Vector Are Found in at Least One Element of A Second Character Vectorgreml
Determine Which Elements of a Character Vector Match at Least One Pattern Contained in Any of the Elements of Another Character Vectorgremlr
Is This a 'add_val_labs()'-style Value-labeled Variable (Column)?h11l has_avl_labs hql
Determine if Vector Has Decimalshas_decv
Is This an 'add_m1_lab()' Many-to-One-Style Value-labeled Variable (Column)?has_m1_labs hm1l
Is this an 'add_quant_labs()'-style Value-labeled Variable (Column)?has_quant_labs
Is This a Value-labeled Variable (Column)?has_val_labs hvl
Return First Rows of a Data Frame with Value Labels Visibleheadl
Initialize labelr Attributesinit_labs
Convert All "Irregular" Data Frame Values to NA or Other Specified Valueirregular2
Replace "Irregular" Values of a Vector with Some Other Valueirregular2v
Test Whether Character Vector Is "Suitable" for Numeric Conversionis_numable
Convert a Value-labeled Integer Variable Column to a Factor Variable Columnint2f lab_int_to_factor
Construct a Fake Demographic Data Framemake_demo_data
Construct a Fake Likert Survey Response Data Framemake_likert_data
Recode Values of a Free-standing Vectorrecode_vals
Restore Factor Status, Levels to a Character Column of a Labeled Data Framerestore_factor_info
Safely Extract Elements of a Labeled Data Framesbrac
Safely Combine Data Frames Column-wisescbind
Safely Change or Add a Data Frame Variable (Column)schange
Safely Drop Specified Columns of a Labeled Data Framesdrop
Safely Filter Rows of a Labeled Data Framesfilter
Safely Generate a Data Frame Variable (Column)sgen
Subset a Data Frame Using Value Labelsslab
Safely Merge Two Data Framessmerge
Return a Random Sample of Data Frame Rows with Value Labels Visiblesomel
Sort Ascending Any Variable Value Labelssort_val_labs
Safely Combine Data Frames Row-wisesrbind
Safely Rename a Variable and Preserve Its Value Labelssrename
Safely Replace a Data Frame Variable (Column)sreplace
Safely Select Specified Columns of a Labeled Data Framesselect
Safely Sort (Re-order) a Labeled Data Framessort
Safely Subset a Labeled Data Framessubset
Strip All labelr Meta-data from a Data Framestrip_labs
Construct Value Label-Friendly Frequency Tablestabl
Return Last Rows of a Data Frame with Value Labels Visibletaill
Transfer Labels from One Variable (Column) Name to Anothertransfer_labs
Swap Name Labels for Variable Namesunl use_name_labs
Replace a Single Data Frame Column's Values with Its Value Labelsuse_val_lab1 uvl1
Swap Variable Value Labels for Variable Valuesuse_val_labs uvl
Swap (back) Original Variable Names for Name Labelsuse_var_names uvn
Specify Column Names without Quoting Themv
Replace a Variable's Values with Its Value Labels and Return as a Vectorval_labs_vec vlv
Overlay Variable Name and Value Labels Onto Arbitrary R Function Callswbl with_both_labs
Overlay Variable Name Labels Onto Arbitrary R Function Callswith_name_labs wnl
Evaluate an Expression in a Value Labels-on Data Environmentwith_val_labs wvl