weight.R -- tryCatch added before weighting functionality implemented