Created
January 20, 2021 01:38
-
-
Save Planeshifter/43929a9bbfb09754e33f8cc724be4d88 to your computer and use it in GitHub Desktop.
Exporting dataset from R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(mosaicData) | |
library(jsonlite) | |
data( HELPrct ) | |
write( toJSON( HELPrct, dataframe = 'columns' ), 'HELPrct.json' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: HELPrct | |
language: en-US | |
state: null | |
license: 'CC BY 4.0 [https://creativecommons.org/licenses/by/4.0]' | |
require: | |
dataFile: 'https://isle.stat.cmu.edu/data-explorers_HELPrct.json' | |
dataInfoFile: 'https://isle.stat.cmu.edu/data-explorers_HELPrct_info.json' | |
--- | |
# HELPrct | |
<DataExplorer | |
data={dataFile} | |
dataInfo={dataInfoFile} | |
categorical={[ | |
factor( 'anysub', [ 'no', 'yes' ]), | |
factor( 'female', [ 0, 1 ]), | |
factor( 'sex', [ 'male', 'female' ]), | |
factor( 'g1b', [ 'no', 'yes' ]), | |
factor( 'homeless', [ 'housed', 'homeless' ]), | |
factor( 'linkstatus', [ 0, 1 ]), | |
factor( 'link', [ 'no', 'yes' ]), | |
factor( 'racegrp', [ 'black', 'hispanic', 'other', 'white' ]), | |
factor( 'satreat', [ 'no', 'yes' ]), | |
factor( 'substance', [ 'alcohol', 'cocaine', 'heroin' ]), | |
factor( 'treat', [ 'no', 'yes' ]), | |
]} | |
quantitative={[ | |
'age', | |
'cesd', | |
'd1', | |
'hospitalizations', | |
'daysanysub', | |
'dayslink', | |
'drugrisk', | |
'e2b', | |
'i1', | |
'i2', | |
'indtot', | |
'mcs', | |
'pcs', | |
'pss_fr', | |
'sexrisk' | |
]} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": [ | |
"The HELP study was a clinical trial for adult inpatients recruited from a detoxification unit. Patients with no primary care physician were randomized to receive a multidisciplinary assessment and a brief motivational intervention or usual care, with the goal of linking them to primary medical care.", | |
"", | |
"Data from the mosaicData v0.20.1 R package by Randall Pruim." | |
], | |
"name": "HELPrct", | |
"variables": { | |
"age": "subject age at baseline (in years)", | |
"anysub": "use of any substance post-detox: a factor with levels no yes", | |
"cesd": "Center for Epidemiologic Studies Depression measure at baseline (high scores indicate more depressive symptoms)", | |
"d1": "lifetime number of hospitalizations for medical problems (measured at baseline)", | |
"hospitalizations": "lifetime number of hospitalizations for medical problems (measured at baseline)", | |
"daysanysub": "time (in days) to first use of any substance post-detox", | |
"dayslink": "time (in days) to linkage to primary care", | |
"drugrisk": "Risk Assessment Battery drug risk scale at baseline", | |
"e2b": "number of times in past 6 months entered a detox program (measured at baseline)", | |
"female": "0 for male, 1 for female", | |
"sex": "a factor with levels male female", | |
"g1b": "experienced serious thoughts of suicide in last 30 days (measured at baseline): a factor with levels no yes", | |
"homeless": "housing status: a factor with levels housed homeless", | |
"i1": "average number of drinks (standard units) consumed per day, in the past 30 days (measured at baseline)", | |
"i2": "maximum number of drinks (standard units) consumed per day, in the past 30 days (measured at baseline)", | |
"id": "subject identifier", | |
"indtot": "Inventory of Drug Use Consequences (InDUC) total score (measured at baseline)", | |
"linkstatus": "post-detox linkage to primary care (0 = no, 1 = yes)", | |
"link": "post-detox linkage to primary care: no yes", | |
"mcs": "SF-36 Mental Component Score (measured at baseline, lower scores indicate worse status)", | |
"pcs": "SF-36 Physical Component Score (measured at baseline, lower scores indicate worse status)", | |
"pss_fr": "perceived social support by friends (measured at baseline, higher scores indicate more support)", | |
"racegrp": "race/ethnicity: levels black hispanic other white", | |
"satreat": "any BSAS substance abuse treatment at baseline: no yes", | |
"sexrisk": "Risk Assessment Battery sex risk score (measured at baseline)", | |
"substance": "primary substance of abuse: alcohol cocaine heroin", | |
"treat": "randomized to HELP clinic: no yes" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment