디렉토리에 들어있는 모든 csv 및 xlsx 파일을 여는 스크립트를 만들었습니다. 내 디렉토리에 파일 형식이 하나도없는 경우 문제가 발생합니다. (예는 : 5 CSV 0 XLSX 또는 0 CSV 및 14 XLSX)함수를 시작하기위한 조건 추가 R
Error in do.call("rbind", xlsx_df) :
le second argument doit être une liste (the second argument must be a list)
은 당신이 어떤 생각을 가지고 있습니까 : 나는 오류 메시지를 받았습니다
#step 1
file.list <- list.files(pattern='*.csv')
csv_df <- lapply(file.list, read.csv, header=TRUE)
#step 2
file.list <- list.files(pattern='*.xlsx')
xlsx_df <- lapply(file.list, read_excel_function)
여기 내 스크립트 모습입니다 list.files가 아무 것도 반환하지 않으면 한 단계 건너 뛰는 조건을 추가하는 방법?
힌트 :'file.list'의 ['length'] (http://stat.ethz.ch/R-manual/R-devel/library/base/html/length.html)은 무엇입니까? 비었다? 'if' 문에서'length'를 조건으로 사용할 수 있습니까? – bouncyball