Referencing worksheets in excel spreadsheet by index rather than name in r -
im trying use xlconnect in order import worksheets datasource
if use code below subsequent error
library(xlconnect) wk = loadworkbook("/users/sebastianzeki/desktop/sequencingscripts/bedtools/bedtools2-master/cohortcomparisons/pancancercommonscnas.xlsx") amp_genesall_cancer = readworksheet(wk, sheet="amp_genes.all_cancer.txt", header=true) error: illegalargumentexception (java): sheet index (-1) out of range (0..25)
one work around convert names numbers of worksheets still need have control on how each 1 imported rather importing 1 dataframe. not sure how though
assuming wk =
code runs correctly, , see 'formal class workbook' object appear, have misspelled sheet name. index -1 means string given title not match.
to use indexes, use:
amp_genesall_cancer = readworksheet(wk, sheet=1, header=true)
with 1 being sheet number
Comments
Post a Comment