从 lapply 读取 R 中 csv 文件中单元格的值

Read the value from a cell in a csv file in R from lapply

在这段代码中,有没有办法请求 csv 文件中特定单元格的整数值,即第 1 行,第 2 列?我知道语法是 [ (2)] 但不确定在这组代码中在哪里输入它?

wd = setwd("/Users/TK/Downloads/DataCSV")

Groups <- list.dirs(path = wd, full.names = TRUE, recursive = FALSE)
print(Groups)

Subj <- list.dirs(path = Groups, full.names = TRUE, recursive = FALSE)
print(Subj)

for(i in Subj)  {

  setwd(i)
  section_area <- list.files(path = i, pattern = "section_area", 
                             full.names = FALSE, recursive = TRUE)
  print(section_area)
  
  read_area <- lapply(section_area, read.csv)
  print(read_area)
  
}

将相关行更改为以下内容应该有效:

read_area <- lapply(section_area, function(x)read.csv(x)[1,2])