match response to fuzzy scales

Everything related to the development of modules in jamovi
Post Reply
lkchan
Posts: 9
Joined: Mon Dec 04, 2023 1:08 am

match response to fuzzy scales

Post by lkchan »

I am developing Fuzzy Delphi module. I tried to do the determination of triangular fuzzy number. I try to match the user data which is Likert5 to Fuzzy number. However I receive the error

Code: Select all

Error in nrow(likert5_data) : object 'likert5_data' not found
Error: unable to load R code in package 'FuzzyDelphiJmv'
Execution halted
ERROR: lazy loading failed for package 'FuzzyDelphiJmv'
* removing 'C:/Users/LerLerChan/Documents/FuzzyDelphiJmv/build/R4.1.2-win64/FuzzyDelphiJmv'
* restoring previous 'C:/Users/LerLerChan/Documents/FuzzyDelphiJmv/build/R4.1.2-win64/FuzzyDelphiJmv' 
Here is the code

Code: Select all


# This file is a generated template, your changes will not be overwritten

FDMClass <- if (requireNamespace('jmvcore', quietly=TRUE)) R6::R6Class(
    "FDMClass",
    inherit = FDMBase,
    private = list(
        .run = function() {
           likert5_data <- data.frame(
              r = 1:5,
              m1 = c(0, 0, 0.25, 0.5, 0.75),
              m2 = c(0, 0.25, 0.5, 0.75, 1),
              m3 = c(0.25, 0.5, 0.75, 1, 1)
            )

          likert5_to_m <- function(response) {
            index <- match(response, likert5_data$r)
            if(!is.na(index)) {
              return(likert5_data[index, c("m1", "m2", "m3")])
            } else {
              return(NA)
            }
          }

          mValues <- likert5_to_m(self$data[[self$options$dep]])
         
         self$results$text$setContent(mValues)
    
    })
)

How should I solve this?
User avatar
jonathon
Posts: 2627
Joined: Fri Jan 27, 2017 10:04 am

Re: match response to fuzzy scales

Post by jonathon »

hi,

apologies for the delay in getting back to you ... it's that time of year.

i think the error is occuring somewhere else in your code. it's complaining about `nrow(likert5_data)` which i can't see in your code.

it must be in some other .R file.

let us know how you get on.

jonathon
lkchan
Posts: 9
Joined: Mon Dec 04, 2023 1:08 am

Re: match response to fuzzy scales

Post by lkchan »

Thank you for the response

I will try my best to code it
https://colab.research.google.com/drive ... sp=sharing

PS; all the best ahhhhh
Post Reply