If you are working with Illumina 450k or similar, you can use the manifest table to annotate your probes. See here: https://bioconductor.org/packages/release/data/annotation/html/IlluminaHumanMethylation450kmanifest.html
I try to install IlluminaHumanMethylation450k.db package for annotation but I came across this error.
Error: package or namespace load failed for 'IlluminaHumanMethylation450k.db': .onLoad failed in loadNamespace() for 'IlluminaHumanMethylation450k.db', details: call: NULL error: 'fun' is defunct. Use 'FDb.InfiniumMethylation.hg19' instead. Use 'FDb.InfiniumMethylation.hg18' instead. Use 'mapToGenome() function in minfi or methylumi' instead. See help("Defunct") Error: loading failed Execution halted ERROR: loading failed * removing 'C:/R/R-3.4.1/library/IlluminaHumanMethylation450k.db'