Need serious help - inherited an R script and I don't program or do this for a living

Hi - I use an R script to validate some results from a survey we do. I am not a programmer and have no idea what I am doing. This thing used to run fine with no errors but I had to upgrade to the new RStudio because my hard drive crashed this year. In doing so, I think there are inherent things wrong with the script that don't agree with the new version.
I had to load "car" and "plyr" packages to start which I figured out how to do.
Now I am getting a new error
Warning: Error in recode: unused arguments (as.numeric.result = F, as.factor.result = T)
47: eval [Z:\LEAP by Measure\Student Perception Survey\SPS\Data Analysis\SPS Data Validation R Script/server.R#110]
46: eval
45: withProgress
44: [Z:\LEAP by Measure\Student Perception Survey\SPS\Data Analysis\SPS Data Validation R Script/server.R#85]
1: shiny::runApp

From line 110
library(car)
dat$SchEdLevel <- recode(dat$SchEdLevelNum, "1='Elementary'; 2='K-8'; 3='Secondary'; else=NA",
as.numeric.result=F, as.factor.result=T)

I don't know what it is referring to with R#85 as it doesn't seem to call out an error.

If anyone can help diagnose my problem I would be very grateful as I have no idea what to do.

FAQ: What's a reproducible example (`reprex`) and how do I do one? will make it possible for community members to help. Otherwise, we're speculating on too much to be really useful.

Unfortunately the latest version of car has changed the arguments of recode, which is why you get the 'unused arguments' error. You may want to downgrade your car package:

remotes::install_version("car", version = "2.1-0")

Otherwise you will need to refactor your script to take into account the backwards-incompatible changes.

3 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.