pivot_wider errors

Hi there
I'm extremely new to R, and am getting an error that I don't understand when trying to use pivot wider:

pivot_wider(cleanservice, names_from = tname, values_from = result)
Error: Must subset columns with a valid subscript vector.
x The subscript has the wrong type `tbl_df<
study_id : character
mrn : double
team : character
location : character
tname : character
tdate : character
result : character
units : character
df : character
auc24 : character
x72h_auc24_mg_h_l: character
peak : double
trough : character
tau : double
ttt : double
tit : double
ttrp : character
averagettp : character
dra : character
hd : character
pd : logical
cvvhd_rrt : logical
add_on : character
team_contacted : character
sydpath : character
data_published : datetime
tat : datetime
notes : character
x29 : logical

My tname column which I want to make into the variables, contains 10 variables. The results column, which I want to be matched under the columns, has data that includes characters, dates, numbers. I don't know if that helps or makes a difference.

Thank you, any assistance is much appreciated.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.