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.
nwc(Table1ex)
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:

library("dplyr")
# 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
nwc(Table1ex_numeric)

Please let me know if this helps! Best,
-Casey

1 Like