@@ -115,11 +115,12 @@ happy_data <- read_csv("data/happiness_report.csv")
115
115
happy_data <- read_csv("/home/dsci-100/worksheet_02/data/happiness_report.csv")
116
116
```
117
117
118
- So which one should you use? Generally speaking, to ensure your code can be run
119
- on a different computer, you should use relative paths. An added bonus is that
120
- it's also less typing! Generally, you should use relative paths because the file's
121
- absolute path (the names of
122
- folders between the computer's root, represented by ` / ` , and the file) isn't usually the same
118
+ So which one should you use? Generally speaking, you should use relative paths.
119
+ Using a relative path helps ensure that your code can be run
120
+ on a different computer (and as an added bonus, relative paths are often shorter&mdash ; easier to type!).
121
+ This is because a file's relative path is often the same across different computers, while a
122
+ file's absolute path (the names of
123
+ all of the folders between the computer's root, represented by ` / ` , and the file) isn't usually the same
123
124
across different computers. For example, suppose Fatima and Jayden are working on a
124
125
project together on the ` happiness_report.csv ` data. Fatima's file is stored at
125
126
@@ -135,18 +136,17 @@ their different usernames. If Jayden has code that loads the
135
136
` happiness_report.csv ` data using an absolute path, the code won't work on
136
137
Fatima's computer. But the relative path from inside the ` project ` folder
137
138
(` data/happiness_report.csv ` ) is the same on both computers; any code that uses
138
- relative paths will work on both!
139
-
140
- In the additional resources section, we include a link to a short video on the
139
+ relative paths will work on both! In the additional resources section,
140
+ we include a link to a short video on the
141
141
difference between absolute and relative paths. You can also check out the
142
142
` here ` package, which provides methods for finding and constructing file paths
143
143
in R.
144
144
145
- Your file could be stored locally, as we discussed, or it could also be
146
- somewhere on the internet (remotely). A * Uniform Resource Locator (URL)* (web
147
- address that looks something like ` https://datasciencebook.ca/ ` ) \index{URL} indicates the location of a resource on the internet and
148
- helps us retrieve that resource. Next, we will discuss how to get either
149
- locally or remotely stored data into R .
145
+ Beyond files stored on your computer (i.e., locally), we also need a way to locate resources
146
+ stored elsewhere on the internet (i.e., remotely). For this purpose we use a * Uniform Resource Locator (URL)* ,
147
+ i.e., a web address that looks something like ` https://datasciencebook.ca/ ` ) \index{URL}.
148
+ URLs indicate the location of a resource on the internet and
149
+ help us retrieve that resource .
150
150
151
151
## Reading tabular data from a plain text file into R
152
152
0 commit comments