library(writexl)
write_xlsx(iris, tmp1 <- tempfile())
file.info(tmp1)$size
[1] 8497
Steven P. Sanderson II, MPH
May 26, 2023
When working with data, it is important to be aware of the file size of the data you are working with. This is especially true when you are working with large datasets, as the file size can have a significant impact on the performance of your code.
In R, there are a number of different ways to write data to files. Each method has its own advantages and disadvantages, and the file size of the output can vary depending on the method you use.
In this blog post, we will discuss why it is a good idea to check the file size output for different methods. We will also provide three examples of how to check the file size output using the R libraries writexl, openxlsx, and xlsx.
There are a number of reasons why it is a good idea to check the file size output for different methods.
In R, there are a number of different ways to check the file size output. Here are three examples of how to check the file size output using the R libraries writexl, openxlsx, and xlsx:
writexl
To check the file size output of the writexl::write_xlsx()
function, you can use the file.info()
function. For example, the following code will write the iris dataset to a temporary file and then print the file size of the
openxlsx
To check the file size output of the openxlsx::write.xlsx()
function, you can use the file.info()
function. For example, the following code will write the iris dataset to a temporary file and then print the file size of the output:
xlsx
To check the file size output of the xlsx::write.xlsx()
function, you can use the file.info() function. For example, the following code will write the iris dataset to a temporary file and then print the file size of the output:
In this blog post, we discussed why it is a good idea to check the file size output for different methods. We also provided three examples of how to check the file size output using the R libraries writexl, openxlsx, and xlsx.
By checking the file size output, you can ensure that the data is being written correctly, optimize the performance of your code, and troubleshoot problems.