-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRtutorial.Rmd
More file actions
46 lines (34 loc) · 834 Bytes
/
Rtutorial.Rmd
File metadata and controls
46 lines (34 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "Rtutorial"
author: "Francisco Roque"
date: "23 de janeiro de 2017"
output: html_document
---
## Introduction
This is the data description....
```{r, echo=FALSE}
# load the data
ourdata <- read.csv("data/Tutorial_Boats.csv", header = TRUE, sep=";")
firstrows <- head(ourdata,5)
firstrows2 <- ourdata[1:5,c(1,4,10,11)]
knitr::kable(firstrows2)
```
Let's now see the correlation of our columns:
```{r, echo=FALSE}
colnames(firstrows2) <- substring(colnames(firstrows2), first = 1, last = 4)
mycorrelationnumbers=cor(firstrows2)
knitr::kable(mycorrelationnumbers)
```
##Apply
```{r, echo=FALSE}
tmp = t(apply(firstrows2,1,summary))
knitr::kable(tmp)
```
Apply my own function
```{r, echo=FALSE}
myfunction <- function(inputvar){
sum(inputvar[1:2])
}
tmp = t(apply(firstrows2,2,myfunction))
knitr::kable(tmp)
```