readxl

Why is R coercing ′ to ' when I try to assign it as a simple character vector but not when I extract it from a list object?

最后都变了- 提交于 2020-07-10 07:31:22
问题 Why is R coercing ′ (the prime symbol) to ' (apostrophe) when I try to assign it as a simple character vector but not when I assign it directly from an list/tibble? Unfortunately, I can't find a simple way to share the data which is the root of this problem, but please hear me out! It is entirely reproducible if you save a super simple .xlsx file with a single value entered (36°48′31.33): and hopefully it will become clear in a second why I can't share this in a more efficient manner. If I

R: Append a worksheet to an excel workbook without reading the entire workbook

一曲冷凌霜 提交于 2020-02-05 08:25:12
问题 I have a 26 mb excel workbook to which I am trying to add a 42 kb worksheet. Using the openxlsx package, I have the following code: wb_object <- loadWorkbook(to_name2) addWorksheet(wb_object, "New Data") writeData(wb_object, sheet = "New Data", m_data) saveWorkbook(wb_object, to_name2, overwrite = TRUE) What I have noticed is that this code takes about 2 minutes to execute. I believe R is reading in the entire 26 mb file and then appending the 42 kb worksheet. Is there any way to append the

Read column names as date format

为君一笑 提交于 2020-01-30 06:33:24
问题 I have date in Excel as follows, first col1 as char and from col2 to col5 is in date format (mm/dd/yyyy) id 1/1/2016 2/1/2016 3/1/2016 4/1/2016 5/1/2016 1 23 545 33 55 66 2 454 536 66 80 11 3 83 585 9 10 19 I tried to import the above file in to R using readxl library, and my result shows column names which are in date format shows as number in dataset, How to import Excel date column with same format? 回答1: As the dataset is in excel format, we can read it with read_excel and then change the

Read column names as date format

烂漫一生 提交于 2020-01-30 06:33:04
问题 I have date in Excel as follows, first col1 as char and from col2 to col5 is in date format (mm/dd/yyyy) id 1/1/2016 2/1/2016 3/1/2016 4/1/2016 5/1/2016 1 23 545 33 55 66 2 454 536 66 80 11 3 83 585 9 10 19 I tried to import the above file in to R using readxl library, and my result shows column names which are in date format shows as number in dataset, How to import Excel date column with same format? 回答1: As the dataset is in excel format, we can read it with read_excel and then change the

Fastest way to read large Excel xlsx files? To parallelize or not?

冷暖自知 提交于 2020-01-21 11:34:10
问题 My questions are: What is the fastest way to read large(ish) .xlsx Excel files into R? 10 to 200 MB xlsx files, with multiple sheets. Can some kind of parallel processing be used , e.g. each core reading a separate sheet of a multi-sheet Excel file? Is there any other kind of optimisation that can be performed? What I have understood (and what I haven't) so far: if reading from spinning disks, as I will, parallel processing may actually slow down the reading as multiple processes try to read

Read multiple xlsx files with multiple sheets into one R data frame

一个人想着一个人 提交于 2020-01-10 10:49:21
问题 I have been reading up on how to read and combine multiple xlsx. files into one R data frame and have come across some very good suggestions like, How to read multiple xlsx file in R using loop with specific rows and columns, but non fits my data set so far. I would like R to read in multiple xlsx files with that have multiple sheets. All sheets and files have the same columns but not the same length and NA's should be excluded. I want to skip the first 3 rows and only take in columns 1:6, 8

Reading data from excel book with many thousand tabs

主宰稳场 提交于 2019-12-22 00:17:27
问题 I am reading in data from individual xlsx files, with the data stored in 10-20 thousand individual tabs in each workbook file. The first sheet contains a master data table, including links to the individual tabs with further data. The column based 'tabbed' data is summarized and transposed before being appended to the master data. The master data table is large (10' thousands rows x hundreds cols) in its own right, the additional data tabs are small in their own rights (a few cols by 10's to

Reading Excel: evaluation error with zip file '..file.xlsx' cannot be opened

依然范特西╮ 提交于 2019-12-19 12:38:24
问题 I am using R with readxl package. I try to import an Excel file with the following command: library(readxl) city_codes <- read_excel("./data/file.xlsx", sheet = "city_codes") It says it is a zip file and cannot be opened: Error in sheets_fun(path) : Evaluation error: zip file './data/file.xlsx' cannot be opened. Any ideas? 回答1: The error message is readxl 's funny way of saying "file not found". That exact line of code gives me the exact same error, and the file doesn't even exist for me.

Import sheets from Excel files located in different folder in R

末鹿安然 提交于 2019-12-11 19:48:28
问题 Basically I have two Excel files with the same name "Checklist" in two different folder (one is 2018 and the other one is 2019). Checklist has different sheets, one for each month : "January", "February" etc... Of course, all the sheets have exactly the same variables. I would like to put in the same data frame all the sheets from both Excel files. For now, I can gather the sheets from one Excel File with : library(readxl) library(tibble) read_excel_allsheets <- function(filename, tibble =

Read All Excel Files into R by Sheet with file name as column

╄→尐↘猪︶ㄣ 提交于 2019-12-11 18:45:57
问题 I have a local folder with excel files in the same format. Each excel file has 10 sheets. I want to be able to do the following: 1) Read all the excel files in R 2) Rbind all the results together but by sheet . 3) Result would be 10 new dataframes with all the excel files rbinded together. 4) New column will be added with file name I have looked up code and the best I could find is this but it doesn't do it by sheet: files = list.files() library(plyr) library(readr) library(readxl) data2