query_data: Query data for standard data packet

Description Usage Arguments Details Examples

View source: R/query_data.R

Description

A function for querying demographic data for standard college data packets. Returns an object with class data.frame and lrdataset

Usage

1
2
3
query_data(dsn, query, demo_names = c("id", "term", "term_desc", "subject",
  "subject_long", "course_number", "age", "matr_goal", "ed_level", "ethnicity",
  "enroll_status", "inst_mode", "language", "gender", "grade"))

Arguments

dsn

A data source name for the archive side of the LRDB. See the readme on how to set up a data source name.

query

A sql query in the form of a character vector or length one the query must pull student id, term (e.g, 1139), term description, subject (e.g., 'PSYC'),long subject ('Psychology'), and official grade.

demo_names

A character vector of column names corresponding with the order of columns in your sql query. The column names must be from a standard list - each column name corresponding with currently supported data (see details) and must contain 'id','term','subject','subject_long', 'grade', and 'term_desc'

Details

In order for this function to yield the necessary data, the user must pass a sql query (param query) for the archive LRDB and a vector of column names (param demo_names) corresponding with the columns of the query. For example, if the first column of the query selected student id, then the first column name provided would be 'id'. The function will only support certain types of query data (e.g., student id, age, etc.), and each of these data types has a standard column name that must be supplied in the same order as the columns in the query. Each column name is listed below with associated query data.

'id' - student id

'term' - 4-digit term identifier

'subject' - 2-5 letter course prefix (e.g., 'PSYC')

'long_subject' - full subject description (e.g, 'Psychology')

'course_number' - course number, up to 3 digits (e.g., 300)

'age' - student age during a given term

'matr_goal' - matriculation goal description (e.g.'Transfer to a 4-year')

'ed_level' - education level description (e.g., 'Completed GED')

'ethnicity' - student race

'inst_mode' - instructional mode description (e.g., 'lecture')

'language' - student's primary language

'gender' - student gender (m,f,u)

'grade' - official course grade (e.g., 'A','B','C', etc.)

Do not modify or recode the data in any way (e.g., with a case when). The column names within the LRDB have not been provided here to keep the structure of the database secure. A standard query can be provided upon request. Contact meinzp@crc.losrios.edu.

Examples

1
2
3
4
5
6
## Not run: 
query_data(dsn = 'datasourcename',
           query = 'select id, term, subject, subject_descr...',
           demo_names = c('id','term','subject','subject_long'))
           
## End(Not run)

paulmeinz/lrdatapacket documentation built on May 24, 2019, 8:45 p.m.