I have the following data:
subset_ipip
    participant group                    date  expName psychopyVersion       OS frameRate globalClockTime                                                 miniIPIP miniIPIPanswer.text   mouse_5.x  mouse_5.y mouse_5.leftButton mouse_5.midButton mouse_5.rightButton mouse_5.time
9         85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        128.4096                               I am the life of the party                   1 0.065000000 -0.4050000                  1                 0                   0      23.9365
10        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        131.9120                      I sympathize with others' feelings.                   5 0.095000000 -0.3816667                  1                 0                   0       3.4857
11        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        139.2848                            I get chores done right away.                   3 0.087500000 -0.3833333                  1                 0                   0       7.3648
12        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        144.6564                             I have frequent mood swings.                   4 0.008333333 -0.4050000                  1                 0                   0       5.3553
13        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        150.4454                              I have a vivid imagination.                   4 0.008333333 -0.4050000                  1                 0                   0       5.7729
14        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        153.6802                                      I don't talk a lot.                   5 0.008333333 -0.4050000                  1                 0                   0       3.2163
15        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        159.4522          I am not interested in other people's problems.                   2 0.008333333 -0.4050000                  1                 0                   0       5.7634
16        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        168.2755 I often forget to put things back in their proper place.                   3 0.008333333 -0.4050000                  1                 0                   0       8.8060
17        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        172.6126                           I am relaxed most of the time.                   1 0.008333333 -0.4050000                  1                 0                   0       4.3292
18        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        183.7722                   I am not interested in abstract ideas.                   1 0.008333333 -0.4050000                  1                 0                   0      11.1408
19        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        189.2099          I talk to a lot of different people at parties.                   1 0.008333333 -0.4050000                  1                 0                   0       5.4183
20        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        192.3508                                 I feel others' emotions.                   5 0.008333333 -0.4050000                  1                 0                   0       3.1244
21        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        196.1494                                            I like order.                   4 0.008333333 -0.4050000                  1                 0                   0       3.7925
22        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        211.6345                                      I get upset easily.                   4 0.150833333 -0.4066667                  1                 0                   0      15.4702
23        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        224.9229          I have difficulty understanding abstract ideas.                   2 0.052500000 -0.4141667                  1                 0                   0      13.2695
24        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        233.8970                                I keep in the background.                   5 0.080000000 -0.4125000                  1                 0                   0       8.9562
25        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        242.8874                    I am not really interested in others.                   1 0.080000000 -0.4125000                  1                 0                   0       8.9745
26        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        256.7221                                 I make a mess of things.                   3 0.098333333 -0.4108333                  1                 0                   0      13.8161
27        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        263.7613                                      I seldom feel blue.                   3 0.126666667 -0.3966667                  1                 0                   0       7.0221
28        85913    24 2023-06-08_16h09.57.937 nappilot        2023.1.1    Win32  59.91971        279.9024                        I do not have a good imagination.                   1 0.126666667 -0.3966667                  1                 0                   0      16.1242
529      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526         77.2520                               I am the life of the party                   2 0.033333333 -0.4050000                  1                 0                   0       7.2920
530      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526         85.7100                      I sympathize with others' feelings.                   3 0.035000000 -0.4141667                  1                 0                   0       8.4510
531      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526         92.7490                            I get chores done right away.                   1 0.050833333 -0.3975000                  1                 0                   0       7.0310
532      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        102.8240                             I have frequent mood swings.                   2 0.058333333 -0.3991667                  1                 0                   0      10.0690
533      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        107.1100                              I have a vivid imagination.                   3 0.054166667 -0.4016667                  1                 0                   0       4.2810
534      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        111.3480                                      I don't talk a lot.                   4 0.040833333 -0.4125000                  1                 0                   0       4.2310
535      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        118.9200          I am not interested in other people's problems.                   3 0.040000000 -0.4083333                  1                 0                   0       7.5680
536      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        126.2270 I often forget to put things back in their proper place.                   1 0.040000000 -0.4083333                  1                 0                   0       7.2990
537      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        135.5180                           I am relaxed most of the time.                   3 0.040000000 -0.4083333                  1                 0                   0       9.2840
538      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        146.8260                   I am not interested in abstract ideas.                   2 0.045000000 -0.4033333                  1                 0                   0      11.3030
539      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        153.2490          I talk to a lot of different people at parties.                   3 0.047500000 -0.4008333                  1                 0                   0       6.4150
540      908829    27 2023-06-08_18h49.55.486 nappilot        2023.1.1 MacIntel  62.73526        159.2370                                 I feel others' emotions.                   2 0.055833333 -0.3950000                  1                 0                   0       5.9820


Please run each unique participant through this type of analysis to get their scores:


# Example usage with the provided ratings vector
ratings <- c(3, 1, 4, 2, 5, 2, 4, 3, 1, 5, 3, 2, 4, 5, 1, 3, 2, 4, 5, 1)
indices_to_reverse <- c(6:10, 15:20)

# Creating a dataframe
df <- data.frame(ratings)

# Adding a new column "ratingsreversed" to the dataframe with reversed ratings
df$ratingsreversed <- reverse_ratings(df$ratings, indices_to_reverse)

# Define the rating ranges and corresponding qualitative markers
rating_ranges <- c(4, 6, 8, 11, 14, 17, 19, Inf)
qualitative_markers <- c("Extremely low", "Very low", "Low", "Neither high nor low; in the middle", "High", "Very High", "Extremely High")

# Function to get the qualitative marker based on a sum and the rating ranges
get_qualitative_marker <- function(sum) {
  marker <- qualitative_markers[findInterval(sum, rating_ranges)]
  return(marker)
}

# Calculate the sums for each category
sum_E <- sum(df$ratingsreversed[c(1, 6, 11, 16)])
sum_A <- sum(df$ratingsreversed[c(2, 7, 12, 17)])
sum_C <- sum(df$ratingsreversed[c(3, 8, 13, 18)])
sum_N <- sum(df$ratingsreversed[c(4, 9, 14, 19)])
sum_O <- sum(df$ratingsreversed[c(5, 10, 15, 20)])

# Get the qualitative marker for each category
marker_E <- get_qualitative_marker(sum_E)
marker_A <- get_qualitative_marker(sum_A)
marker_C <- get_qualitative_marker(sum_C)
marker_N <- get_qualitative_marker(sum_N)
marker_O <- get_qualitative_marker(sum_O)

# Create a dataframe with the scores and qualitative markers
result <- data.frame(Category = c("E", "A", "C", "N", "O"),
                     Score = c(sum_E, sum_A, sum_C, sum_N, sum_O),
                     QualitativeMarker = c(marker_E, marker_A, marker_C, marker_N, marker_O))

# Printing the updated dataframe
print(result)