Skip to content

Commit

Permalink
Quick edits in locations
Browse files Browse the repository at this point in the history
  • Loading branch information
FulyaGokalp2 committed Dec 13, 2024
1 parent c6911f1 commit 85e9349
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
7 changes: 3 additions & 4 deletions tools-appendix/modules/r/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ R project site contains an extensive bibliography of books related to R: <http:/

Here are some (tentative) topics covered in R section:


* xref:reading-and-writing-data.adoc[Reading and Writing Data]
* xref:variables.adoc[Variables]
* xref:logical-operators.adoc[Logical Operators]
* xref:lists-and-vectors.adoc[Lists and Vectors]
* xref:data-frames.adoc[Data.Frames]
* xref:reading-and-writing-data.adoc[Reading and Writing Data]
* xref:data-frames.adoc[Data Frames]
* xref:control-flow.adoc[Control Flow]
* xref:writing-functions.adoc[Writing Functions]
* xref:writing-functions.adoc[Functions]
* xref:r-base-functions.adoc[R Base Functions]
* xref:apply-functions.adoc[Apply Functions]
* xref:plotting.adoc[Plotting]
22 changes: 18 additions & 4 deletions tools-appendix/modules/r/pages/reading-and-writing-data.adoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
= Reading and Writing Data

== Examples
If you are working with datasets in R, there are various ways to handle them. One of the most common tasks is importing your existing data into R. To do this, you first need to know your current working environment. You can use the following command to check your working directory:

=== How do I read a csv file called `grades.csv` into a data.frame?
[source, R]
----
getwd()
----

This command will return the path of your current working directory, which is where R looks for files by default when reading or saving data.

Also, `.` means the current working directory.

`.` means the current working directory.
Change your working directory:

[source, R]
----
setwd("the place you want to go!")
----

=== How do I read a csv file called `grades.csv` into a data.frame?

So, if we were in `/home/john/projects`, that is our current working directory.
If we were in `/home/john/projects`, that is our current working directory.

`./grades.csv` is the same as `/home/john/projects/grades.csv`.
In this case, `./grades.csv` is the _relative_ path.
Expand Down

0 comments on commit 85e9349

Please sign in to comment.