Optimization nwc

I am working on Optimization in R using the TransP package. when I use the nwc function on my dataset(file), it gives me this error. Please, what can I do. I am a newbie in R.
Error in FUN(X[[i]], …) :
only defined on a data frame with all numeric variables

1 Like

Hello @s_madamedon. From what I understand with the information provided, it looks like the nwc() function can only handle numeric variables in a dataframe. You can reduce your dataframe to only numeric variables with the select_if() function from the dplyr package. The syntax might look something like this:

# Select only numeric variables and save the results as "Table1ex_numeric"
Table1ex_numeric <- select_if(Table1ex, is.numeric)

# Now run the nwc() function on your dataframe that contains only numeric information

Please let me know if this helps! Best,

1 Like