You can add annotations as metadata columns (mcols) in the Granges object:
library(GenomicRanges)
# Make the Granges object
ranges_df <- data.frame(chrom = c("I", "I", "III"), start = c(100, 10000, 200), end = c(200, 10200, 250), strand = c("-", "-", "+"))
regions <- makeGRangesFromDataFrame(ranges_df)
# Make new metadata column called "feature"
mcols(regions)$feature <- ""
# Assign feature based on position
mcols(regions[seqnames(regions) == "I" & start(regions) >200]) <- "gene"
Alternatively, you might have a list of features and you might want to annotate your regions based on whether they overlap with the features:
# Make new metadata column called "feature"
mcols(regions)$feature <- ""
# Make Granges object for the feature of interest
genes_df <- data.frame(chrom = c("I", "IV", "III"), start = c(150, 700, 500), end = c(250, 10200, 750), strand = c("-", "-", "+"))
genes <- makeGRangesFromDataFrame(genes_df)
# Find overlaps and assign feature to regions
hits <- findOverlaps(query = regions, subject = genes, ignore.strand = TRUE)
mcols(regions[queryHits(hits)])$feature <- "gene"