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

Unlock the full course today

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

Text files in R

Text files in R

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

Start my 1-month free trial

Text files in R

- [Instructor] Let's talk about importing just standard text files and by standard text files I mean something that's not formatted, it's not comma separated, it's not tab delimited. If you look down in chapter two exercise files in the sample files folder, I've provided the text for A Mid Summer Night's Dream, which is a play, it's by Shakespeare and you'll notice that this text file, it has line breaks but there is no tabs, there are no fields indicating the contents of the next field or nothing's broken up, it's just random text in a text file. But sometimes this is the way you're going to get data and so we need to learn how to deal with it. Let's look at four functions that we can use to import text files and the results of each of them. The first thing that I'm going to assume is that you've changed your working directory to the chapter 02 and that will make sure that all of our code actually calls up the right files. The next thing I'm going to do is create a vector called…

Contents