0

So, this is "ibdcoef" table:

Colname  ID1     ID2           k0        k1   kinship
33995   22441 OM0131 0.0000000000 0.0000000 0.5000000
176589  41995  38082 0.0000000000 0.0000000 0.5000000
206956  32660  44840 0.0000000000 0.0000000 0.5000000
213655   4913   1619 0.0000000000 0.0000000 0.5000000
216159   2181   1621 0.0000000000 0.0000000 0.5000000
242935  26506  26503 0.0009746209 0.9988834 0.2497918
244709 E02024  28909 0.0000000000 0.0000000 0.5000000
245181  23168  44529 0.0000000000 0.0000000 0.5000000
272140  41673  45589 0.0000000000 0.0000000 0.5000000
276130 MM0010 MM0007 0.2585263289 0.4901194 0.2482070
276142 MM0010 MM0008 0.4825443561 0.5174556 0.1293639
278507 MM0007 MM0008 0.5104724894 0.4635960 0.1288648

Data types are as follows: chr; chr; num; num; num;

And the code I want to execute is:

sample.counts <- arrange(count(c(ibdcoef$ID1, ibdcoef$ID2)), -freq)}

However, R displays an error message:

Error in UseMethod("groups") : no applicable method for 'groups' applied to an object of class "character"

It seems that the function 'count' does not execute this table input. Could You point out on some possible issues with it and how to adress them in code?

edit: Package 'dplyr' is open, so that's not an issue.

juststuck
  • 616
  • 5
  • 17
  • They ("someone") are using *dplyr* package, see linked post. This is called "group by count". In your case it will be something like this (not tested): `ibdcoef %>% group_by(ID1, ID2) %>% summarise(freq = n()) %>% arrange(freq)` – zx8754 Dec 07 '18 at 10:17
  • I have dplyr package open as well. – juststuck Dec 07 '18 at 10:23
  • Please edit your post, and add what you are trying to achieve, what is the expected output? – zx8754 Dec 07 '18 at 10:25
  • I just need code to execute without error, which it doesn't. I'm very frustrated as per author of code (https://www.r-bloggers.com/genome-wide-association-studies-in-r/) it should go silky smooth. – juststuck Dec 07 '18 at 10:27
  • Could You please de '[dublicated]' this post? I have really searched stackoverflow in and out before posting this. – juststuck Dec 07 '18 at 10:30
  • Explain what is the expected output. For me at the moment the link is a perfect fit for "group by count". – zx8754 Dec 07 '18 at 10:31
  • The thing is that there doesn't seem to be an issue with the code itself, rather, something with regards to data i provided (related to the error message). I will try to edit post so it's more clear. Thanks! – juststuck Dec 07 '18 at 10:42

0 Answers0