forked from tandrasfay/Project1
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathR Code
More file actions
67 lines (51 loc) · 2.96 KB
/
R Code
File metadata and controls
67 lines (51 loc) · 2.96 KB
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
# platform x86_64-pc-mingw32
# arch x86_64
# os mingw32
# system x86_64, mingw32
# status
# major 2
# minor 15.1
# year 2012
# month 06
# day 22
# svn rev 59607
# language R
# version.string R version 2.15.1 (2012-
# Before running this R code, run Sys.getenv("HOME"). This will return a file path.
Download all of the txt files in the repo to the last directory in the file path: Visual, Aural, ReadWrite, and Kinesthetic, and truefalse
setwd(Sys.getenv("HOME"));
visual_data = read.table("Visual.txt", sep = "")
aural_data = read.table("Aural.txt", sep = "")
readwrite_data = read.table("ReadWrite.txt", sep = "")
kinesthetic_data = read.table("Kinesthetic.txt", sep = "")
visual_data = factor(visual_data$V2, levels = 1:15)
aural_data = factor(aural_data$V2, levels = 1:15)
readwrite_data = factor(readwrite_data$V2, levels = 1:15)
kinesthetic_data = factor(kinesthetic_data$V2, levels = 1:15)
attach(mtcars)
par(mfrow=c(4,1))
plot(visual_data, col = 'blue', main = "Number of People in each Category for Visual Learning", xlab = "Categories", ylab = "Number of People", xlim = c(0,15), width = .85)
plot(aural_data, col = 'orange', main = "Number of People in each Category for Aural Learning", xlab = "Categories", ylab = "Number of People", xlim = c(0,15), width = .85)
plot(readwrite_data, col = 'yellow', main = "Number of People in each Category for Read/Write Learning", xlab = "Categories", ylab = "Number of People", xlim = c(0,15), width = .85)
plot(kinesthetic_data, col = 'red', main = "Number of People in each Category for Kinesthetic Learning", xlab = "Categories", ylab = "Number of People", xlim = c(0,15), width = .85)
par(mfrow=c(1,1))
data = data.frame(table(visual_data), table(aural_data), table(readwrite_data), table(kinesthetic_data))
plot(data)
legend("bottomright", col = c('blue','orange','yellow','red'), legend = c('visual', 'aural', 'read/write', 'kinesthetic'))
tools = read.table("truefalse.txt", sep = "", colClasses = "character")
strings_in_df = tools[suppressWarnings(is.na(as.numeric(tools[,1]))),]
colnames = strings_in_df$V2[-13]
m = matrix(0, ncol = 12, nrow = 48)
data = data.frame(m)
colnames(data) = colnames
tools = tools[suppressWarnings(!is.na(as.numeric(tools[,1]))),]
for (i in 1:length(colnames))
data[, i] = tools$V2[((i-1)*48+1):(i*48)]
boolean_data = (data == "True")
boolean_data = boolean_data*1
m = matrix(0, ncol = 1, nrow = 12)
plot_data = data.frame(m)
rownames(plot_data) = colnames
for (i in 1:12)
plot_data[i,] = sum(boolean_data[,i])
dotchart(plot_data[,1], labels = rownames(plot_data), main = "Number of Leaders on each Topic", xlab = "Number of People")