ภาษา r เบื้องต้น

Post on 30-Dec-2015

89 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

ภาษา R เบื้องต้น. Computer Program in Education Research and Measurment ธวัชชัย เอี่ยมไพโรจน์. RGui. ออกจาก RGui. Help ใน R. help(print). การเปลี่ยนไดเรคทอรี. การเรียกไฟล์คำสั่งของ R มาทำงาน. exsample.R. # draw a smooth line through a scatter plot - PowerPoint PPT Presentation

TRANSCRIPT

ภาษา R เบื้��องต้�น

Computer Program in Education Research and Measurment

ธวั�ชช�ย เอ��ยมไพโรจน�

RGui

ออกจาก RGui

Help ใน R

help(print)

การเปลี่��ยนไดเรคทอร�

การเร�ยกไฟลี่�ค$าสั่��งของ R มาท$างาน

exsample.R

# draw a smooth line through a scatter plotplot(cars, main="Stopping Distance versus Speed")

lines(stats::lowess(cars))

การจ�ดการพ��นฐานก�บื้ numbers แลี่ะ vector

• x <- c(10.4, 5.6, 3.1, 6.4, 21.7)

หร�อ• assign(“x”, c(10.4, 5.6, 3.1, 6.4, 21.7)

x<- c(10.4, 5.6, 3.1, 6.4, 21.7)

print(x)

x=edit(x)

1/x

v<- 2*x + y + 1

log, exp, sin, cos, length ..etc.

paste()

?paste

Probability Distributions

help(Normal)

help(TDist)

help(Binomial)

Basic Plots

• Strip Charts

• Histograms

• Boxplots

• Scatter Plots

• Normal QQ Plots

help(stripchart)

stripchart(x) ; m <- mean(par("usr")[1:2])

help(hist)

hist(islands)

help(boxplot)

boxplot(count ~ spray, data = InsectSprays, col = "lightgray")

Scatter Plots

• plot()

• cor()

help(plot)

plot(cars)

help(cor)

cor(cbind(P = Cl[i], S = clS[i], K = clK[i]))

help(qqnorm)

qqnorm(precip, ylab = "Precipitation [in/yr] for 70 US cities")

Rcmdr

R Commander

Load Package Rcmdr

R Commander

Data Editor

Import from SPSS data set.

library(foreign, pos=4)

Dataset <- read.spss("C:/Documents and Settings/Administrator/Desktop/Data_SPSS/data6.sav", use.value.labels=TRUE, max.value.labels=Inf, to.data.frame=TRUE)

SPSS data set in R.

load("C:/Documents and Settings/Administrator/Desktop/Data_R/data11a2.RData")

Save : script & output file ?

Questions ?... Comments

http://www.kuisociety.net

http://www.r-burapha.com

top related