From the course: R Programming in Data Science: High Variety Data

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Write rows and columns to Excel

Write rows and columns to Excel

From the course: R Programming in Data Science: High Variety Data

Start my 1-month free trial

Write rows and columns to Excel

- Writing a row or a column to an Excel spreadsheet is exactly the same as writing a range to an Excel spreadsheet. So, let's step through the process. We're going to use Open XLSX, but rather than just duplicate the process we went through before in Chapter 0105, let's do a couple of different things. To set up, be sure that you've set your working directory to Chapter 01, and if you haven't already, install packages for Open XLXS, go ahead and do that, and then, use the library command, library(openxlsx), to make sure that the library is available for you. Now, I'm going to need some data to write in, so I'm going to use Small Table for range, and create a data frame into that vector, and now, we're ready to start writing out rows. This time, rather than writing to an existing workbook, I'm going to create a brand new Excel workbook. So, I need to set up a vector to save a reference to it, so I'm going to create something called workingXLSX, and into that vector, I'm going to create…

Contents