"unused arguments" error with my own data and FactoMineR/ Factoshiny

I'm trying to do Multiple Factor Analysis for a wetlands study since I have qualitative (yes/no) and quantitative (size in m^2 and %). Previously my data was in binary but I switched it back to yes/no because I thought that might have been part of the problem but I get the same error(s).

When I run:

> setwd("file location") 
> wetlands <- read.table("wetlands.csv",
+ header=TRUE, sep=",", dec=".", row.names=1)
> 
> result <- Factoshiny(wetlands)

Factoshiny loads and lets me select an analysis type but in its description it says all my variables are quantitative. "The dataset wetlands has 21 individuals, and 9 variables: All the variables are quantitative." and then when I select MFA, I get "ERROR: unused arguments (choices = list(gettext("None", domain = "R-Factoshiny"), gettext("All", domain = "R-Factoshiny"), gettext("Choose", domain = "R-Factoshiny")), selected = partial, inline = TRUE)" and in R the error is "

Listening on http://Factoshiny

Warning: Error in radioButtons: unused arguments (choices = list(gettext("None", domain = "R-Factoshiny"), gettext("All", domain = "R-Factoshiny"), gettext("Choose", domain = "R-Factoshiny")), selected = partial, inline = TRUE) 71: dots_list 70: div 69: conditionalPanel Warning: Error in radioButtons: unused arguments (choices = list(gettext("None", domain = "R-Factoshiny"), gettext("All", domain = "R-Factoshiny"), gettext("Choose", domain = "R-Factoshiny")), selected = partial, inline = TRUE) 71: dots_list 70: div 69: conditionalPanel

"

Attached is my dataset. Any advice would be greatly appreciated!
disdata

Welcome @Leah in the Community.
My first impression is that the format of the data set that are trying to analyze does not fit the requirements of the Facto* functions. It would help me (and others looking into this) when you show the contents of the wetlands file not as a graphical illustration but in R format.
After reading the csv into variable wetlands you can call the function dput and copy the result in a reply as e.g. here with your own data:

wetlands= data.frame(
  A=c(1,2,3,4),
  B=c(1,2,3,4),
  C=c(1,2,3,4),
  D=c(1,2,3,4)
)

dput(wetlands)

structure(list(A = c(1, 2, 3, 4), B = c(1, 2, 3, 4), C = c(1, 
2, 3, 4), D = c(1, 2, 3, 4)), class = "data.frame", row.names = c(NA, 
-4L))

And by using str(wetlands) you can already see how the read.table function handled the csv file.

1 Like

Thank you @HanOostdijk! I'm sorry I'm very new to all of this and I'm not sure what to do with wetlands=data.frame(...) do I put in my variables instead of A, B, C, etc. and then values for 1, 2, 3?

The rest came out as follows:

> setwd("C:/filelocation") 
> wetlands <- read.table("wetlands.csv",
+ header=TRUE, sep=",", dec=".", row.names=1)
> dput(wetlands)
structure(list(Wet_Dom = c(1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L), Hydric_Soil = c(0L, 
0L, 0L, 1L, 0L, 1L, 0L, 0L, NA, 1L, 1L, 1L, 1L, 1L, 0L, 1L, NA, 
1L, 1L, 1L, 1L), GW_Recharge = c(1L, NA, NA, 1L, NA, 1L, 0L, 
1L, NA, 1L, 0L, 0L, 1L, 1L, 0L, 0L, NA, 1L, 0L, 0L, 0L), Flood_Alt = c(1L, 
NA, NA, 1L, NA, 1L, 0L, 1L, NA, 1L, 1L, 0L, 0L, 0L, 0L, 1L, NA, 
1L, 1L, 1L, 1L), Sed_Retention = c(1L, NA, NA, 1L, NA, 1L, 0L, 
0L, NA, 0L, 1L, 1L, 1L, 1L, 1L, 0L, NA, 0L, 0L, 0L, 0L), Nutrient_Rem = c(0L, 
NA, NA, 1L, NA, 1L, 0L, 1L, NA, 1L, 1L, 1L, 1L, 1L, 1L, 0L, NA, 
1L, 1L, 1L, 1L), Habitat = c(0L, NA, NA, 1L, NA, 1L, 0L, 0L, 
NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L, 1L), Actual_Size.m2. = c(148.68, 
0, 0, 273.45, 0, 1184.94, 40.6, 187.2, 0, 541.3, 1060.6, 36.33, 
363.8, 276.06, 423.64, 969.63, 0, 148.65, 92.9, 269.42, 32.52
), Complete... = c(100.15, 0, 0, 101.5, 0, 121.47, 24.28, 45, 
0, 97, 74, 33, 51, 99.8, 92, 70, 0, 100, 100, 100, 100)), class = "data.frame", row.names = c("Progress", 
"Hickory", "MitA", "MitB", "MitC", "MitD", "MitEF", "1", "2", 
"3", "4", "5", "6", "7", "8", "9", "10", "11_A", "11_B", "11_C", 
"12"))
> str(wetlands)
'data.frame':   21 obs. of  9 variables:
 $ Wet_Dom        : int  1 0 0 1 0 1 1 0 0 1 ...
 $ Hydric_Soil    : int  0 0 0 1 0 1 0 0 NA 1 ...
 $ GW_Recharge    : int  1 NA NA 1 NA 1 0 1 NA 1 ...
 $ Flood_Alt      : int  1 NA NA 1 NA 1 0 1 NA 1 ...
 $ Sed_Retention  : int  1 NA NA 1 NA 1 0 0 NA 0 ...
 $ Nutrient_Rem   : int  0 NA NA 1 NA 1 0 1 NA 1 ...
 $ Habitat        : int  0 NA NA 1 NA 1 0 0 NA 1 ...
 $ Actual_Size.m2.: num  149 0 0 273 0 ...
 $ Complete...    : num  100 0 0 102 0 ...
>

No this is exactly what I hoped you would deliver.
So all fields are Boolean (or unknown) except the last two that are numeric.
I will have a look.

1 Like

I have very little experience with MFA but by converting the 'Boolean' variables to character and creating groups in the Shiny app I got some plots and numbers. So probably this helps (if you don't have a recent version of dplyr you can do the as.character separately for each Boolean variable) :

library(Factoshiny)
library(dplyr)

wetlands2 = wetlands %>%
  mutate(across(Wet_Dom:Habitat,as.character))

res.shiny <- MFAshiny(wetlands2)
1 Like

Thank you! Now I'm at group creation in the Factoshiny interface and I'm trying to create the groups one by one since there are only 9 variables. I made a group for each variable and tried to validate the groups but I get "Error: infinite or missing values in 'x'" no matter what I do. Can you please tell me how you grouped the data to produce graphs? Does anything need to be done with the "Other MFA Parameters" etc? Again, thank you so much for all your help!

Edit: Is the issue that some sites only have "0" or NA data?

You made a group for each qualitative variable?
It is rather late where I live, but tomorrow I will include the generated MFA code.

1 Like

I tried making groups for all variables individually but have tried different things since then, e.g. quantitative in one group, qualitative in another; quantitative in one group with qualitative in individual groups; and quantitative in individual groups with qualitative in two groups: qualities (Wet_Dom & Hydric_Soil) and functions (the rest of the qualitative data), etc. I also tried selecting "other MFA parameters", putting in sites with missing data (2,3,5,9,17), and "Impute with 2-dimensional MFA-model (good compromise)". It also comes up with the errors "not convenient group definition" "and "non-conformable arguments".

Sorry for all the confusion, I haven't used Rstudio in a very long time and have never done MFA before. Thanks again and have a good night.

@Leah: this morning I had also problems with getting MFA to produce 'some results'. I had to include the row.names statement to get it working again. (No idea why this was not necessary yesterday).
I include:

  • the full code that I ran in a fresh R session
  • the setup for the groups (the last group with habitat did not fit the page). I worked with all the defaults so also no changes in 'other MFA parameters'
  • the panel with the results when I clicked on 'validate the groups'
  • the generated MFA code that I got by clicking on 'Get the MFA code'

As I said before: I can not say anything about the value of the MFA results. No experience with that.

wetlands=structure(list(Wet_Dom = c(1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L), Hydric_Soil = c(0L, 
0L, 0L, 1L, 0L, 1L, 0L, 0L, NA, 1L, 1L, 1L, 1L, 1L, 0L, 1L, NA, 
1L, 1L, 1L, 1L), GW_Recharge = c(1L, NA, NA, 1L, NA, 1L, 0L, 
1L, NA, 1L, 0L, 0L, 1L, 1L, 0L, 0L, NA, 1L, 0L, 0L, 0L), Flood_Alt = c(1L, 
NA, NA, 1L, NA, 1L, 0L, 1L, NA, 1L, 1L, 0L, 0L, 0L, 0L, 1L, NA, 
1L, 1L, 1L, 1L), Sed_Retention = c(1L, NA, NA, 1L, NA, 1L, 0L, 
0L, NA, 0L, 1L, 1L, 1L, 1L, 1L, 0L, NA, 0L, 0L, 0L, 0L), Nutrient_Rem = c(0L, 
NA, NA, 1L, NA, 1L, 0L, 1L, NA, 1L, 1L, 1L, 1L, 1L, 1L, 0L, NA, 
1L, 1L, 1L, 1L), Habitat = c(0L, NA, NA, 1L, NA, 1L, 0L, 0L, 
NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L, 1L), Actual_Size.m2. = c(148.68, 
0, 0, 273.45, 0, 1184.94, 40.6, 187.2, 0, 541.3, 1060.6, 36.33, 
363.8, 276.06, 423.64, 969.63, 0, 148.65, 92.9, 269.42, 32.52
), Complete... = c(100.15, 0, 0, 101.5, 0, 121.47, 24.28, 45, 
0, 97, 74, 33, 51, 99.8, 92, 70, 0, 100, 100, 100, 100)), 
class = "data.frame", row.names = c("Progress", 
"Hickory", "MitA", "MitB", "MitC", "MitD", "MitEF", "1", "2", 
"3", "4", "5", "6", "7", "8", "9", "10", "11_A", "11_B", "11_C", 
"12"))

library(Factoshiny)
library(dplyr)

wetlands2 = wetlands %>%
  mutate(across(Wet_Dom:Habitat,as.character))
row.names(wetlands2) = row.names(wetlands)  # NEW !

res.shiny <- MFAshiny(wetlands2)

newDF <- wetlands2[,c("Wet_Dom","Hydric_Soil","GW_Recharge","Flood_Alt","Sed_Retention","Nutrient_Rem","Habitat")]
res.MFA<-MFA(newDF,group=c(1,1,1,1,1,1,1), type=c("n","n","n","n","n","n","n"),name.group=c("Gr 1","Gr 2","Gr 3","Gr 4","Gr 5","Gr 6","Gr 7"),graph=FALSE)
plot.MFA(res.MFA, choix="ind",lab.par=FALSE,title="Individual factor map")
plot.MFA(res.MFA, choix="group")
plot.MFA(res.MFA, choix="axes",habillage='group')
2 Likes

Thank you so much Han, you've been unbelievably helpful!

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