Email : noviaalbl02@gmail.com
RPubs : https://rpubs.com/noviaanita/
Jurusan : Fisika Medis
Address : ARA Center, Matana University Tower
Jl. CBD Barat Kav, RT.1, Curug Sangereng, Kelapa Dua, Tangerang, Banten 15810.
Buatlah fungsi dengan bahasa pemrograman R untuk menghitung:
library(mosaicCalc)## Loading required package: mosaicCore
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
fungsi = makeFun(x^2+3~x)
TentuTakTentu <- function(x)
{
f = antiD(x^2+3*x ~ x)
tentu= f(3) - f(1)
tak_tentu= f(1:3)
return(cat(c("Integral Tentu:", tentu, "\n",
"Integral Tak Tentu:", tak_tentu)))
}
TentuTakTentu(x)## Integral Tentu: 20.6666666666667
## Integral Tak Tentu: 1.83333333333333 8.66666666666667 22.5
Sebuah roda sepeda yang berbentuk lingkaran memiliki diameter sebesar 14 cm. Maka luas dan keliling roda tersebut adalah ?
Luas_keliling_volume <- function(pi,r)
{
Luas = pi*r^2
Keliling = 2*pi*r
Volume = 4/3*pi*r^3
return(cat("Luas:", Luas, "\n",
"Keliling:", Keliling, "\n",
"Volume:", Volume))
}
Luas_keliling_volume(22/7,14)## Luas: 616
## Keliling: 88
## Volume: 11498.67
| Nilai | Frekuensi |
| 31-36 | 4 |
| 37-42 | 6 |
| 43-48 | 10 |
| 49-54 | 14 |
| 55-60 | 8 |
| 61-66 | 5 |
| 67-72 | 2 |
x <- c(4,6,10,14,8,5,2)
maximum=max(x)
max(x)## [1] 14
Nilai <-seq(31-36,67-72,0)
Frek <-c(4,6,10,14,8,5,2)
min_frek <- function(x,frek)
{
keluaran=min(frek)
return(cat("Nilai Minimum:", keluaran))
}
min_frek(Nilai, Frek)## Nilai Minimum: 2
# Create a vector.
x <- c(4,6,10,14,8,5,2)
# Find Mean.
result.mean <- mean(x)
median.result <- median(x)
print(result.mean)## [1] 7
print(median.result)## [1] 6
getmode <- function(v) {
uniqv <- unique(v)
uniqv[which.max(tabulate(match(v, uniqv)))]
}
v <- c(4,6,10,14,8,5,2)
result <- getmode(v)
print(result)## [1] 4
x <- c(4,6,10,14,8,5,2)
variansi=var(x)
standart=sd(x)
var(x)## [1] 16.33333
sd(x)## [1] 4.041452
div.main-container {
max-width: 1280px;
}
.main-container {
max-width: 1280px;
}
div.tocify {
width: 20%;
max-width: 280px;
max-height: 85%;
}
.tocify {
border: 1px solid #50719447;
}
body {
text-align: justify
}
a {
color: #2f4b7c;
text-decoration: none;
}
p {
margin: 0 0 13px;
font-size: 1.1em;
font-family: "calibri", Garamond, 'Comic Sans MS';
}
.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus {
z-index: 2;
color: #ffffff;
background-color: #003f5c;
border-color: #2f4b7c;
}
.nav>li>a:hover, .nav>li>a:focus {
text-decoration: none;
background-color: #1a242f;
color: white;
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {
color: #2c3e50;
background-color: #ffffff;
border: 1px solid #1a242f;
border-bottom-color: transparent;
cursor: default;
}
.nav-tabs {
border-bottom: 1px solid #1a242f;
}
.nav-pills li>a {
border: 2px solid #f47c3c40;
}
.nav-pills>li.active>a, .nav-pills>li.active>a:hover, .nav-pills>li.active>a:focus {
color: #ffffff;
background-color: #006b21c4;
}
.nav>li>a:hover, .nav>li>a:focus {
text-decoration: none;
background-color: #bbc1c78a;
color: #6f6f6f;
}
.tocify {
border: 1px solid #1a242f;
}
.tocify-extend-page {
height: 24px !important;
}
h1 {
font-size: 1.4em;
font-weight: bolder;
}
h2, h3 {
font-size: 1.2em;
font-weight: bolder;
}
h3 {
font-size: 1.1em;
font-weight: bolder;
}
h1.title {
font-size: 1.8em;
}
em {
color: #ff7c43;
margin-left: .5%;
margin-right: .5%;
font-weight: bold;
}
.date > em {
font-size: 0.8em;
}
h4.author > em {
color: white;
text-decoration: initial;
background: black;
border-radius: 6px;
padding: 6px 8px;
margin: 5% 0;
font-size: 0.8em;
}
code > span.kw {
color:#54b4eb;
}
p > code {
background-color: #ecf0f1!important;
padding: 0.2%;
margin: 0.2%;
font-weight: 500;
}
pre {
font-size: 16px;
background-color: #6f6f6f;
border: 1px solid #d2d2d2;
}
pre > code {
color: #656565;
}
code.sourceCode.r {
color: white;
}
code > span.ot {
color: #ef6d5f;
}
code > span.st {
color: #37982c;
}
code > span.dt {
color: #2f4b7c;
}
code > span.dv {
color: #2f4b7c;
}
code > span.fl {
color: #18bc9c;
}
#header:after {
content: " ";
display: block;
margin-top: 2%;
margin-bottom: 2%;
}
code span.kw {
color: #ff7c43;
}
img {
color: white;
font-style: italic;
padding: 2px;
text-align: center;
margin: 5px;
}