Difference between revisions of "R: Import"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (Created page with " # Read tab separated values read.delim(file.choose()) # Read comma (",") separated values read.csv(file.choose()) # Read semicolon (";") separated values read.csv2(file...") |
Onnowpurbo (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ==Normal== | ||
# Read tab separated values | # Read tab separated values | ||
Line 7: | Line 8: | ||
read.csv2(file.choose() | read.csv2(file.choose() | ||
+ | ==Fast Read== | ||
+ | |||
+ | library("readr") | ||
+ | # Read tab separated values | ||
+ | read_tsv(file.choose()) | ||
+ | # Read comma (",") separated values | ||
+ | read_csv(file.choose()) | ||
+ | # Read semicolon (";") separated values | ||
+ | read_csv2(file.choose()) | ||
+ | |||
+ | |||
+ | ==Excel== | ||
+ | |||
+ | # Use readxl package to read xls|xlsx | ||
+ | library("readxl") | ||
+ | my_data <- read_excel("my_file.xlsx") | ||
+ | # Use xlsx package | ||
+ | library("xlsx") | ||
+ | my_data <- read.xlsx("my_file.xlsx") | ||
+ | |||
+ | ==Referensi== | ||
+ | |||
+ | * http://www.sthda.com/english/wiki/importing-data-into-r | ||
==Pranala Menarik== | ==Pranala Menarik== | ||
* [[R]] | * [[R]] |
Latest revision as of 10:35, 28 November 2019
Normal
# Read tab separated values read.delim(file.choose()) # Read comma (",") separated values read.csv(file.choose()) # Read semicolon (";") separated values read.csv2(file.choose()
Fast Read
library("readr") # Read tab separated values read_tsv(file.choose()) # Read comma (",") separated values read_csv(file.choose()) # Read semicolon (";") separated values read_csv2(file.choose())
Excel
# Use readxl package to read xls|xlsx library("readxl") my_data <- read_excel("my_file.xlsx") # Use xlsx package library("xlsx") my_data <- read.xlsx("my_file.xlsx")