read.murl {muRL} | R Documentation |
Read a .csv file or R dataframe of letter recipients
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
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", field.instShort = "instShort",
colClasses = c("character"), ...)
Arguments
file |
the name of a |
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. |
field.instShort |
a character string giving the name of the column containing the shortened version of the name of the institution. Optionally used in the closing. |
colClasses |
a vector of character strings indicating the class of each column. Using |
... |
other arguments to pass to |
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 rtm@american.edu and Andrew Reeves reeves@wustl.edu
See Also
Examples
## Specify path to .csv database of sample addresses
fpath <- system.file("extdata", "murljobs.csv", package = "muRL")
murljobs <- read.murl(fpath)