Learn R Programming

SwimmeR (version 0.3.0)

Swim_Parse: Formats swimming and diving data read in with Read_Results into dataframe

Description

Takes the output of Read_Results and cleans it.

Usage

Swim_Parse(
  file,
  avoid = avoid_default,
  typo = typo_default,
  replacement = replacement_default
)

swim_parse( file, avoid = avoid_default, typo = typo_default, replacement = replacement_default )

Arguments

file

output from Read_Results

avoid

a list of strings. Rows in x containing these strings will not be included. For example "Pool:", often used to label pool records, could be passed to avoid. The default is avoid_default, which contains many strings similar to "Pool:", such as "STATE:" and "Qual:". Users can supply their own lists to avoid.

typo

a list of strings that are typos in the original results. Swim_Parse is particularly sensitive to accidental double spaces, so "Central High School", with two spaces between "Central" and "High" is a problem, which can be fixed. Pass "Central High School" to typo. Unexpected commas as also an issue, for example "Texas, University of" should be fixed using typo and replacement

replacement

a list of fixes for the strings in typo. Here one could pass "Central High School" (one space between "Central" and "High") and "Texas" to replacement fix the issues described in typo

Value

returns a dataframe with columns Name, Place, Grade, School, Prelims_Time, Finals_Time, Points, & Event. Note all swims will have a Finals_Time, even if that time was actually swam in the prelims (i.e. a swimmer did not qualify for finals). This is so that final results for an event can be generated from just one column.

See Also

Swim_Parse must be run on the output of Read_Results

Examples

Run this code
# NOT RUN {
Swim_Parse(Read_Results("http://www.nyhsswim.com/Results/Boys/2008/NYS/Single.htm", node = "pre"),
 typo = c("-1NORTH ROCKL"), replacement = c("1-NORTH ROCKL"))
 
# }
# NOT RUN {
Swim_Parse(Read_Results("inst/extdata/Texas-Florida-Indiana.pdf"),
 typo =  c("Indiana  University", ", University of"), replacement = c("Indiana University", ""))
 
# }

Run the code above in your browser using DataLab