New to R. Recently working through an [ATAC-seq workshow in R][1].  

In Section 5.1 of where I call the makeGRangesFromDataFrame function I get the following error -
 

    > atac_esca.gr <- makeGRangesFromDataFrame(atac_esca,keep.extra.columns = T)
     Error in makeGRangesFromDataFrame(atac_esca, keep.extra.columns = T) : could not find function "makeGRangesFromDataFrame"

I had previously installed the GenomicRanges package and I tried again. No joy. So I attached the package `require(GenomicRanges)` and now when I receive the following error when I go to repeat the same call - 

     > atac_esca.gr <- makeGRangesFromDataFrame(atac_esca,keep.extra.columns = T)
    Error in inherits(object, class2) : 'what' must be a character vector

[Edit]: 

         > dput(head(atac_esca,10))
    structure(list(seqnames = c("chr1", "chr1", "chr1", "chr1", "chr1", 
    "chr1", "chr1", "chr1", "chr1", "chr1"), start = c(1290095, 1291115, 
    1291753, 1440824, 1630188, 2030218, 2184484, 2185113, 2185905, 
    2186860), end = c(1290596, 1291616, 1292254, 1441325, 1630689, 
    2030719, 2184985, 2185614, 2186406, 2187361), name = c("ESCA_107", 
    "ESCA_108", "ESCA_109", "ESCA_160", "ESCA_179", "ESCA_341", "ESCA_539", 
    "ESCA_540", "ESCA_541", "ESCA_542"), score = c(2.46437811814343, 
    2.58792851900195, 7.57996223017863, 4.46727398384637, 20.6213237496952, 
    15.5725811237533, 19.2854359599157, 11.1907656456091, 22.2148888990001, 
    22.8844119795596), annotation = c("3' UTR", "3' UTR", "3' UTR", 
    "3' UTR", "3' UTR", "3' UTR", "3' UTR", "3' UTR", "3' UTR", "3' UTR"
    ), percentGC = c(0.676646706586826, 0.702594810379242, 0.63872255489022, 
    0.658682634730539, 0.728542914171657, 0.6187624750499, 0.578842315369261, 
    0.604790419161677, 0.63872255489022, 0.439121756487026), percentAT = c(0.323353293413174, 
    0.297405189620758, 0.36127744510978, 0.341317365269461, 0.271457085828343, 
    0.3812375249501, 0.421157684630739, 0.395209580838323, 0.36127744510978, 
    0.560878243512974)), spec = structure(list(cols = list(seqnames = structure(list(), class = c("collector_character", 
    "collector")), start = structure(list(), class = c("collector_double", 
    "collector")), end = structure(list(), class = c("collector_double", 
    "collector")), name = structure(list(), class = c("collector_character", 
    "collector")), score = structure(list(), class = c("collector_double", 
    "collector")), annotation = structure(list(), class = c("collector_character", 
    "collector")), percentGC = structure(list(), class = c("collector_double", 
    "collector")), percentAT = structure(list(), class = c("collector_double", 
    "collector"))), default = structure(list(), class = c("collector_guess", 
    "collector")), skip = 1), class = "col_spec"), row.names = c(NA, 
    10L), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame"))

[Edit]: 

    > head (atac_esca)
      seqnames   start     end     name     score annotation percentGC percentAT
    1     chr1 1290095 1290596 ESCA_107  2.464378     3' UTR 0.6766467 0.3233533
    2     chr1 1291115 1291616 ESCA_108  2.587929     3' UTR 0.7025948 0.2974052
    3     chr1 1291753 1292254 ESCA_109  7.579962     3' UTR 0.6387226 0.3612774
    4     chr1 1440824 1441325 ESCA_160  4.467274     3' UTR 0.6586826 0.3413174
    5     chr1 1630188 1630689 ESCA_179 20.621324     3' UTR 0.7285429 0.2714571
    6     chr1 2030218 2030719 ESCA_341 15.572581     3' UTR 0.6187625 0.3812375

    > packageVersion("GenomicRanges")
    [1] ‘1.38.0’

    > class(atac_esca)
    [1] "spec_tbl_df" "tbl_df"      "tbl"         "data.frame" 
   

Can anyone tell me what I am doing wrong here?

[Using R Studio 1.2.5033 - R 3.6.3 - Windows 10]

Thanks in advance,

R.


  [1]: https://rpubs.com/tiagochst/atac_seq_workshop

Output of `packageVersion("GenomicRanges")`,  `head(atac_esca)` and `class(atac_esca)`? Never seen this error message and I use this function like every day. Could be Windows-related or your data frame is in fact not a df but a different class like any of these dplyr formats. I also suggest to never use T/F but always TRUE/FALSE to avoid misinterpretations. And yes, of course you have to load the package first before being able to call functions from it, `GenomicRanges` is not a base package so you will have to load it at every new session.