This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
library(mosaicCalc)
## Loading required package: mosaic
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## The 'mosaic' package masks several functions from core packages in order to add
## additional features. The original behavior of these functions should not be affected by this.
##
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
##
## count, do, tally
## The following object is masked from 'package:Matrix':
##
## mean
## The following object is masked from 'package:ggplot2':
##
## stat
## The following objects are masked from 'package:stats':
##
## binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
## quantile, sd, t.test, var
## The following objects are masked from 'package:base':
##
## max, mean, min, prod, range, sample, sum
## Loading required package: mosaicCore
##
## Attaching package: 'mosaicCore'
## The following objects are masked from 'package:dplyr':
##
## count, tally
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
library(mosaic)
gf_point(height ~ age, data=datasets::Loblolly)
Beberapa pinus berusia tiga tahun dengan tinggi yang sangat mirip diukur
dan dilacak dari waktu ke waktu: usia lima tahun, usia sepuluh tahun,
dan seterusnya. Pohon-pohon berbeda satu sama lain, tetapi semuanya
sangat mirip dan menunjukkan pola sederhana: pertumbuhan linier pada
awalnya yang tampaknya menurun seiring waktu. Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code
that generated the plot.
Definisi fungsi-fungsi ini mungkin tampak aneh pada awalnya — mereka sepenuhnya ditentukan oleh data: tidak ada parameter! Meskipun demikian, mereka adalah fungsi asli dan dapat bekerja dengan seperti fungsi lainnya.
library(mosaicCalc)
Cherry <- datasets::trees
gf_point(Volume ~ Girth, data = Cherry)
library(mosaicCalc)
g1 = spliner(Volume ~ Girth, data = Cherry)
## Warning in regularize.values(x, y, ties, missing(ties)): collapsing to unique
## 'x' values
g2 = connector(Volume ~ Girth, data = Cherry)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
slice_plot(g1(x) ~ x, domain(x = 8:18)) %>%
slice_plot(g2(x) ~ x, color ="red") %>%
gf_point(Volume ~ Girth, data = Cherry) %>%
gf_labs(x = "Girth (inches)")
melewati setiap titik data. (Satu-satunya pengecualian adalah dua titik
dengan keliling 13 inci. Tidak ada fungsi yang dapat melewati kedua
titik dengan keliling 13, jadi fungsi membagi selisih dan melewati
rata-rata dari dua titik.)
g4 <- smoother(Volume ~ Girth, data=Cherry, span=1.0)
gf_point(Volume~Girth, data = Cherry) %>%
slice_plot(g4(Girth) ~ Girth) %>%
gf_labs(x = "Girth (inches)", y = "Wood volume")
mereka membangun fungsi smooth yang mendekati data. Anda memiliki
kendali atas seberapa mulus fungsi tersebut. Parameter hiper
spanmengatur ini
library(devtools)
## Loading required package: usethis
g5 <- smoother(Volume ~ Girth+Height,
data = Cherry, span = 1.0)
gf_point(Height ~ Girth, data = Cherry) %>%
contour_plot(g5(Girth, Height) ~ Girth + Height) %>%
gf_labs(x = "Girth (inches)",
y = "Height (ft)",
title = "Volume (ft^3)")