I am doing a school assignment and I find a  snippet of code extremely confusing.  I have copied and pasted it from the assignment to here.
    library(limma)
    library(tidyverse)
    library(ggplot2)
    library(knitr)
    library(Biobase)
    library(GEOquery)
    
    eset <- getGEO("GSE4051", getGPL = FALSE)[[1]]
 

This part is what I find confusing.  Later on pData(eset) gets called and the value of the method being called has been changed.  What is going on?  pData(eset) is actually an object or something?  I don't understand why this isn't being saved as a global variable.

     pData(eset) <- pData(eset) %>%
      mutate(sample_id = geo_accession) %>%
      mutate(dev_stage =  case_when(
        grepl("E16", title) ~ "E16",
        grepl("P2", title) ~ "P2",
        grepl("P6", title) ~ "P6",
        grepl("P10", title) ~ "P10",
        grepl("4 weeks", title) ~ "4_weeks"
      )) %>%
      mutate(genotype = case_when(
        grepl("Nrl-ko", title) ~ "NrlKO",
        grepl("wt", title) ~ "WT"
      ))
    
    pData(eset) %>%
      with(table(dev_stage, genotype))
`getGEO(...)` returns an object, and you are assigning this object to the `eset` variable. You can check the object class using `class(eset)`. The object type is likely S4, which for us means it has various slots that store different pieces of information.

Whatever object type eset is likely had "setter" and "getter" generic functions defined for a particular slot. The getter `pData(eset)` extracts data from an object slot, and the setter `pData(eset) <-` adds data to an object slot.

`pData(eset) <- pData(eset) %>% ...` is getting data from an object slot, manipulating the data, and then saving it back into the same object slot.

You can read more information about this topic in the [S4 objects chapter of Advanced R](https://adv-r.hadley.nz/s4.html).