Here's a dplyr solution, which IHMO is the most readable:
library(dplyr)
x %>%
group_by(SNP) %>%
summarize(
genes = paste(gene, collapse = ','),
hu_mRNA = paste(hu_mRNA, collapse = ',')
)
The result:
Source: local data frame [5 x 3]
SNP genes hu_mRNA
(fctr) (chr) (chr)
1 chr1.111642529 H3F3A,H3F3B NM_002107,NM_005324
2 chr1.111801684 BC098118
3 chr1.111925084 GJC2 NM_020435
4 chr1.11801605 ,C13orf33 AK027740,NM_032849
5 chr1.151220354 PCDHGA10,PCDHGA5 NM_018913,NM_018918