简体   繁体   中英

R: Separate xlsx doc into multiple tibbles

I have an excel spreadsheet that I created from data on this site https://www.ucrdatatool.gov/Search/Crime/State/RunCrimeStatebyState.cfm

It is Crime statistics of the US by state from 1970 - 2000. I need a way to separate each state into it's own tibble.

I tried using read_excel() with these parameters: "CrimeStatebyState.xlsx" range=10:41 but I got this error :

Error in UseMethod("as.cell_limits") : 
  no applicable method for 'as.cell_limits' applied to an object of class "c('integer', 'numeric')"

I have tried :

Alabama <- split(Crime_US, cell_rows(10:41))

and received this error: data length is not a multiple of split variable

it's slice(), the function that subsets a dataframe. it's slice().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM