-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomework #1.R
67 lines (46 loc) · 1.02 KB
/
Homework #1.R
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
67
# 8/26/21
# First Statistics Class
# I can use R to add
3+2
# In R you can create objects
z <- 300/100
# Save a word as an object
x <- "Word"
# Change x to a number
x <- 5
# Here's some other examples of objects
Word <- "Word"
Number <- 1
Calculation <- 3+2
# Sequence of numbers
seq(1,10)
# Save it in an object
seq <- seq(1,10)
#Repeat a number
rep(10, times = 25)
# Put that in an object
Repeat <- rep(10, times = 25)
# Make sequence of 25 numbers
Sequence <- seq(1,25)
# Create a dataset
Dataset <- data.frame(Repeat, Sequence)
# Use head command
head(iris)
# What kinds of variables do I have in my dataset?
# use the str command
str(iris)
# Names of the variables
names(iris)
# Row names
rownames(iris)
# Create table
table(iris$Species)
# How to specify a variable
iris$Petal.Width
# Look at a different variable
iris$Sepal.Length
# Create a dataframe
Dataframe <- data.frame(
Words = c("one", "two", "three", "four"),
Numbers = c(1,2,3,4))
#Summary command - Gives overview of the dataset