Output

data<-read.table(header=TRUE, text='
No. gender age
1 Male 17
2 Female NA
3 Male 29
4 Male 14
')
data
##   No. gender age
## 1   1   Male  17
## 2   2 Female  NA
## 3   3   Male  29
## 4   4   Male  14

Menyimpan Data diatas di C:

write.table(data,"dataset.csv",sep="t/",row.names = FALSE)

Redirect Console Output

for (i in 1:5){print("Hello")}
## [1] "Hello"
## [1] "Hello"
## [1] "Hello"
## [1] "Hello"
## [1] "Hello"

Menyembunyikan output program (Baca Halaman 117)/tersimpan sebagai file.txt

sink('output.txt')
for(i in 1:5) {print("Hello")}
## [1] "Hello"
## [1] "Hello"
## [1] "Hello"
## [1] "Hello"
## [1] "Hello"

Module XLS

library(openxlsx)
data<-read.table(header=TRUE, text='
No. gender age
1 Male 17
2 Female NA
3 Male 29
4 Male 14
')
write.xlsx(data,"dataku.xlsx")

File SPSS,SAS,Stata

library(foreign)
data<-read.table(header=TRUE, text='
No. gender age
1 Male 17
2 Female NA
3 Male 29
4 Male 14
')
#Write a SPSS file
write.foreign(data,"mydata.txt","mydata.sps", package = "SPSS")
#Write a SAS file
write.foreign(data,"mydata.txt","mydata.sas",package = "SAS")
## Some variable names were abbreviated or otherwise altered.
#write stata binary format
write.dta(data,"mydata.dta")

Grafik

titik<-c(10,4,2,9,3,8)
titik
## [1] 10  4  2  9  3  8
plot(titik)

plot(titik,type = "l")

plot(titik,type = "s")

plot(titik,type = "b")

plot(titik,type = "p")

plot(titik,type = "S")

plot(titik,pch=8, type="b") #type pch halaman 121

#Untuk melihat data yang tersedia di Rstudio

data()