I want to pivot a t-table, where you usually look up the sum-scores of a finished questionnare and read the corresponding T-Value in the leftmost column. For some further excel operations e.g. VLOOKUP() i need the tables as shown in the 2nd picture. (data is not exact the same, its from another worksheet)
All possible sum-scores need to be in the leftmost column and the according t-value should be in the corresponding column right of it.
I dont know where to start.
I tried grouping the ua columns and pivoting like
df_long <- df %>%
pivot_longer(cols = starts_with("ua"),
values_to = "Score") %>%
arrange(desc(Score))
but this creates some other colums treated as factors and surely not the expected output. Further complicating matters is the presence of NA-Values.
Any advises?
I uploaded the xlsx.file to we-transfer
https://wetransfer.com/downloads/783d404d25fef64fbaf3c8c2dbbe17d120240204224649/7d5f70
I suspect most others will be reluctant to download the .xlsx file, and images of data are discouraged. Would it be possible share data.frames after you have read in the data from Excel? Using
dput
could you share in your post at least first 10 rows or so of each? If not, perhaps creating a simple toy dataset that would represent the problem? Perhaps you can use a rolling closest join if you want a tidyverse solution.thanks for the reply, ill update my code when ive got some more time