Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Help me! Rating scale nodes logging

edited January 2016 in OpenSesame

Hello!

I'm working on an experiment that includes rating scales (going from 1-9), but when I run the experiment, in the logging document the rating is logged from 0-8 and I would like this to be logged as 1-9, but I don't know how to change this! Can someone please help me with this?

Thanks in advance!

Comments

  • edited 3:28PM

    Hi Eykman,

    I believe Python starts counting at 0 so thats the reason your values are lower. If you want to count the 'normal' way you could add an inline_script directly after your rating scale form and add:

    var.question1 = var.question1 + 1
    var.question2 = var.question2 + 1
    etc.
    

    Or, if needed, replace 'question' with the name of your variable.

    Laurent

  • Hi,

    When I tried to do it with the latest OpenSesame, I got an error as below.

    "TypeError: can only concatenate str (not "int") to str"

    I know what it means, but what is the best way to solve it with OpenSesame script (in a form_base plugin)?


    Thanks

  • Hi @rrr,

    A "TypeError: can only concatenate str (not "int") to str" error in rsponse to something like:

    var.question1 = var.question1 + 1
    

    ...means that one of the two elements you're trying to add is not numerical but a string. In this specific example, since 1 is definitely numerical, it must mean that var.question1 is a string. I'm gonna assume that the var.question1 contains the string form of a digit (e.g., "1"). You'd have to convert the string to an integer number. You can doi that using the parseInt() function in Javascript. Note that there are other ways to convert a string to a numerical value (see https://deadsimplechat.com/blog/5-ways-to-convert-string-to-a-number-in-javascript/) but in this specific case, partseInt should do.

    var.question1 = parseInt(var.question1) + 1
    

    Hope this helps,

    Fabrice.

    Buy Me A Coffee

  • Hi @Fab ,

    Thank you for the advice.

    Does it mean that we just add the code in python inline script? An error happens like "NameError: name 'parseInt' is not defined".

    Also I'm just wondering whether there are easier way to log rating data along with the scale points such as 1-7.


    Thanks

  • Hi @rrr,

    parseInt is a javascript function. If you're using Python, you'd just have to use the Pythin equivalent (wihch is Int). the logic remains the same.

    There are any mumber of ways to collect ratings. If all you need is for the participant to select a value from, say 1 to 7, in response to a single item or statement, you could of course just present the statement in a sketchpad and use a keyboard object to take a response (1 to 7).

    Best,

    Fabrice.

    Buy Me A Coffee

Sign In or Register to comment.