-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday_3_b.Rmd
70 lines (50 loc) · 993 Bytes
/
day_3_b.Rmd
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: "Day 3 Part 2"
author: "Dalila Lara"
date: "2022-08-03"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(palmerpenguins)
```
### Creating and Working with Vectors
### Make some vectors
```{r}
marmots <- c("blue", "green", 4, "yellow")
marmots
# Check class of object
class(marmots)
```
### Numberic Vectors
```{r}
pika <- c(12.4, 6.8, 2.9, 8.8, 8.5 )
class(pika)
# Scalar Multiplier
scalar_pika <- 5.2 * pika
scalar_pika
#Be aware of whats getting stored and what is being reported
```
```{r}
bananas <- c(1, 2, 3, 4)
apples <- c(6, 7, 8)
bananas + apples
bananas - apples
#dot product (0)
#bananas %*% apples
```
### Matrices
```{r}
#my_values <- seq(from = 1, to = 10, length = 200)
my_values <- seq(from = 1, to = 10,)
my_matrix <- matrix(data = my_values, nrow = 2, ncol = 5, byrow = TRUE)
class(my_matrix)
5 * my_matrix
```
```{r}
glimpse(penguins)
```
```{r}
# a cool update!
```