lgsmith295 / pcrecon

Principal Component Regression analysis for tree ring data
MIT License
2 stars 0 forks source link

increase flexibility and checks for function get_climate #28

Open lgsmith295 opened 4 years ago

lgsmith295 commented 4 years ago

Right now requires very specific column names.

Make helper functions that change colnames to the format required by the function, i.e. check if any colname(climate) match c("jan", "Jan", "january", "January") change it to "1", etc.

Check that "year" col contain 4 digit consecutive integers.

nnnagle commented 4 years ago

try

select(df, starts_with('jan', ignore.case = TRUE))
nnnagle commented 4 years ago

even better, use rename to standardize names

test <- tibble(FEB=seq(1:5))
rename(test, Feb = starts_with('feb',ignore.case = TRUE))

crashes if more than one column match, though. Example, doesn't work:

test <- tibble(FEB=seq(1:5), feb = seq(6:10))
rename(test, Feb = starts_with('feb',ignore.case = TRUE))