I don't know anything about the behavior of casestovars (or any other command in SPSS for that matter), but to get your desired output, you could add a ConditionID column to your data and then use tidyr's pivot_wider().
Thank you so much for the reply. I am really grateful for the answer you provided. However, I see that you make the column condition ID before you pivot the table. Unfortunately, my actual data that I am working with ,has millions of observations and numbering the column condition ID would not be feasible. Is there a way in R that the conditions can be set up from long to wide (numbering condition 1, condition 2, and so forth) based on CaseID alone and with out having to add a column.
Thanks again for the help.
In this case you could try to group your data by the CASEID, create a nested column and use tidyr's unnest_wider() to bring it in the wide format. You will get NAs if the Case IDs have different frequencies, but this is unavoidable with the wide format.
Thank you again for an excellent answer. Unfortunately, I have to use another platform which has R embedded in it (data can't be downloaded due to privacy concerns) and may have old versions of libraries and I can't seem to update them. The cur_data function can not be performed on this platform despite uploading the libraries mentioned in the post. Is there a replacement for the function cur_data?
Hey,
Thanks man for the help. You are a life-savior. I have been working on this for the last whole week. I have been able to do it now. Yes Unnest_wider worked on that system. Looks like the system is not that old.