need to calculate the frequency of the occurrence of a variable

Asked

Viewed 276 times

1

I have two vectors, one with 387 codes and another with 3,000 occurrences of one or more of these 387 codes. I need to know how many times each of these 387 codes occurred in this vector of the 3,000 occurrences. I’ve done loops "for" and it worked, but the execution time is huge. I tried to use the command "table" but it didn’t work. I saw a suggestion from daniel but it creates a data-frame with two variables (ok) but with the same number of lines, which is not my case.

  • 2

    What didn’t work out in charge table? Also, provide your data set, or a part of it (command dput) so that your problem can be reproduced.

  • I’m sorry, Rafael, I was using the "table" command inappropriately, now it worked. Thanks for the message,

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.