R Studio Notes
R Studio Notes
ii.
7. Manipulating Data – Basic R Functions
a. Using “Pipe-Operator” Function:
i. my_data %>%, press enter
ii. select(Column Name 1, Column Name 2, Column Name 3, etc), press ctrl + enter):
includes only selected named columns
iii. filter (Column Name < Value & Column Name > Value): Includes column values with
only those ranges of values
iv. arrange(Column Name): arranges spreadsheet by specific column
8. Importing Data from Excel into R Studio
a. Download Excel File, drag it to Documents Folder under Project of interest
b. Excel File will show up under Tabs Section
c. Click on .xlsx file, will give option for “import dataset”
d. Once you click “import dataset”, will see the following screen
e.
i. Data Preview shows the spreadsheet in preview form. You can change the variable
type of the column by clicking the drop-down arrow
ii.
3. Range: Maximum Number of Rows (can edit, leaving it as is will import max
rows)
4. Skip: Will skip designated amount of rows (example: “2” will skip first two
rows)
5. First Row as Names: R will automatically use the first row as the name of the
column unless specified otherwise by unclicking
6. Open Data Viewer: will open data immediately after importing it
7. NA: input specific value from excel will rename it as NA in the imported file
iv. To Import Excel Sheet into R, click the clipboard icon, then press cancel. Once back
in R studios, in the Coding Section, paste the code
1. NOTE: If you haven’t already, making sure to download and run (library or
require readxl) library(readxl) or require(readxl)