searchSDF {EdSurvey}R Documentation

EdSurvey Codebook Search


Retrieves variable names and labels for an, a, or an using character string matching.


searchSDF(string, data, fileFormat = NULL, levels = FALSE)



a vector of character strings to search for in the database connection object (data). The function will search the codebook for a matching character string using regular expressions. When a string has several elements, all must be present for a variable to be returned.


an, a, or an


a character string indicating the data source to search for variables. The default NULL argument searches all codebooks.


a logical value; set to TRUE to return a snapshot of the levels in an


a data.frame that shows the variable names, labels, and levels (if applicable) from an or a based on a matching character string


Michael Lee and Paul Bailey


## Not run: 
# read in the example data (generated, not real student data)
sdf <- readNAEP(system.file("extdata/data", "M36NT2PM.dat", package="NAEPprimer"))

# search both the student and school files by a character string
searchSDF(string="book", data=sdf)

# use the `|` (OR) operator to search several strings simultaneously
searchSDF(string="book|home|value", data=sdf)

# use a vector of strings to search for variables that contain multiple strings,
# such as both "book" and "home"
searchSDF(string=c("book","home"), data=sdf)

# search only the student files by a character string
searchSDF(string="algebra", data=sdf, fileFormat="student")

# search both the student and school files and return a glimpse of levels
searchSDF(string="value", data=sdf, levels=TRUE)

# save the search as an object to return a full data.frame of search
ddf <- searchSDF(string="value", data=sdf, levels=TRUE)

## End(Not run)

[Package EdSurvey version 2.7.1 Index]