Basics - Data Import

Description of issue - Hey there midterm tomorrow and have no idea what I'm doing. Is it possible to import data off a spreadsheet on a word doc?

System Information:

  • RStudio Edition: (Desktop or Server)
  • RStudio Version:
  • OS Version:
  • R Version:
  • sessionInfo():

Referred here from support.rstudio.com

Hi @jamb061! Welcome!

Extracting data from Word documents (do you mean in a table inside a Word document?) is possible, but speaking very frankly, if you feel like you “have no idea what you’re doing”, it’s not the place to start. It’s not really a basic task, because the data usually needs a lot of wrangling to get it into usable form. Here’s a vignette (R-speak for a documentation article) from one package that does this: https://davidgohel.github.io/officer/articles/officer_reader.html

If you’re just starting out, I’d strongly recommend seeing if you can get the data into an Excel workbook (xlsx) or into CSV (comma separated values) format first. Then you can use RStudio’s built-in wizard to import it: https://support.rstudio.com/hc/en-us/articles/218611977-Importing-Data-with-RStudio

Note that people do a lot of stuff with spreadsheets that is not friendly for data importing, so how thorny the Excel import gets depends on how well the spreadsheet is laid out in the first place.

I hope you’ll ask more questions here! (Maybe when it’s not the night before a midterm... :upside_down_face:). If you do, you should take a look at our FAQs for helpful tips on how this community works: https://forum.posit.co/faq

4 Likes