R/typecheck.R

Defines functions typecheck

#Helper function

#Checks that data have been entered into the function correctly
#Many functions require that the data is formattted as a vector of values,
#rather than a df or as part of a matrix.

#If data is passed to the function in matrix/df format, typecheck will take the column in
#question and convert it from a df into a vector of values.
typecheck <- function(df){
  x <- typeof(df)

  if (x == "double"){
    df = df
  }
  else{
    df <- df[[1]]}
  return(df)
}

Try the r4lineups package in your browser

Any scripts or data that you put into this service are public.

r4lineups documentation built on May 2, 2019, 7:10 a.m.