Hi, I am not very experienced in programming. Therefore I have problems in finding a suitable solution for my problem. I would like to calculate cosine similarity in R, however in this way, that I compare each row (a participant) with the "ground truth" (expert). For example:

I have 5 rows:

t_all_1<- c(0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0)

t_all_2<- c(0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0)

t_all_3<- c(0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0)

t_all_4<- c(0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0)

t_all_5<- c(0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0)

and in these five rows, I would like to compare each row with the output of an expert:

tadol_all_1<- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0)

How to do this? I assume I have to "store" somehow all the rows in a matrix, but then what, how to create that each row of the five rows above is automatically compared to the expert row and cosine similarity calculated?

Thanks in advance for help!