read.murl: Read a .csv file or R dataframe of letter recipients

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/read.murl.R

Description

Reads a .csv file or R dataframe of letter recipients, processes the column names for write.murl, checks whether United States ZIP codes conform to standard formats, and reports potential problems to the user.

Usage

1
2
3
4
5
6
read.murl(file = "murljobs.csv", header = TRUE, stringsAsFactors = 
FALSE, field.title = "title", field.fname = "fname", field.lname = 
"lname", fields.address = "address", field.city = "city", 
field.state = "state", field.zip = "zipcode", field.position = 
"position", field.subfield = "subfield", field.dept = "dept", 
field.institution = "institution", colClasses = c("character"), ...)

Arguments

file

the name of a .csv file or R dataframe.

header

a logical for whether the first row of the input file or dataframe is a header row.

stringsAsFactors

a logical for whether character strings should be stored as factors with levels.

field.title

a character string giving the name of the column containing recipients' titles (such as “Doctor", “Mrs.", etc.).

field.fname

a character string giving the name of the column containing recipients' first names.

field.lname

a character string giving the name of the column containing recipients' last names.

fields.address

a character string common to the name(s) of the column(s) containing recipients' street mailing address information. Each column will be printed as its own row in the mailing address. See Details below for more.

field.city

a character string giving the name of the column containing recipients' cities.

field.state

a character string giving the name of the column containing recipients' states or provinces.

field.zip

a character string giving the name of the column containing recipients' United States ZIP or other postal codes.

field.position

a character string giving the name of the column containing recipient-specific information, such as the specific position for which one is applying.

field.subfield

a character string giving the name of the column containing recipient-specific information, such as the specific subfield for which one is applying.

field.dept

a character string giving the name of the column containing additional information, such as the specific department offering the position for which one is applying.

field.institution

a character string giving the name of the column containing additional information, such as the institution offering the position for which one is applying.

colClasses

a vector of character strings indicating the class of each column. Using c(``character'') ensures leading zeros in, for example, ZIP codes will be preserved.

...

other arguments to pass to read.csv() if the input file is a .csv file.

Details

Recipients' addresses are formatted for mailing as follows. The first row contains the contents of the fields defined by field.title, field.fname, and field.lname. Each of the fields defined by fields.address is formatted as a unique row. The last row contains the contents of the fields defined by field.city, field.state, and field.zip.

fields.address specifies the string common to the names of the columns containing the recipients' street addresses. For example, if the user's file has the street address in columns named addr1, addr2, ..., then the user should set fields.address = "addr".

If the input file is an R dataframe, then the argument ... is ignored.

Value

An R dataframe containing the relevant information for creating a set of standardized but customizable letters to be mailed.

Author(s)

Ryan T. Moore [email protected] and Andrew Reeves [email protected]

See Also

write.murl, zip.plot

Examples

1
2
3
4
## Specify path to .csv database of sample addresses
fpath <- system.file("extdata", "murljobs.csv", package = "muRL")

murljobs <- read.murl(fpath)

Example output

Loading required package: maps
Loading required package: stringr

muRL documentation built on June 20, 2017, 9:15 a.m.