-
Notifications
You must be signed in to change notification settings - Fork 0
/
analysis.R
76 lines (62 loc) · 2.26 KB
/
analysis.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
68
69
70
71
72
73
74
#####################################################################################
# Generic function to analyze distribution of Ramanujan numnbrs
#
# Usage: nohup R --no-save < analysis.R
# OR
# R # then
# source("analysis_2.R")
#
# Installation:
# install.packages('sqldf')
#
####################################################################################
######################################
# Load required packages
######################################
library(sqldf)
library(ggplot2)
######################################
# Read in file of akk numbers
######################################
# NOTE: file created using
# cat ramanujan*.txt > combined_numbers.txt
# (, ), and done removed
# cat rama*.txt combined_numbers.txt > ALL.txt
# (, ), and done removed
str_filename = 'runs/ALL.txt'
copy_numbers <- read.csv(file = str_filename, sep = ',',
header = FALSE, stringsAsFactors=FALSE, na.strings="..")
copy_numbers
####################################
# select unique numbers
####################################
ramanujan_numbers = sqldf("select distinct(V5) as x
from copy_numbers
order by x ")
####################################
# plot histogram
####################################
hist(log10(as.numeric(ramanujan_numbers$x)), main="Histogram for Ramanujan numbers",
xlab="Log10 of Ramanujan numbers",
border="black",
col="blue", breaks = 100)
hist((as.numeric(ramanujan_numbers$x)), main="Histogram for Ramanujan numbers",
xlab="Ramanujan numbers",
border="black",
col="blue", breaks = 100)
gp2 <- ggplot(ramanujan_numbers, aes(x=x))
gp2 <- gp2 + geom_histogram()#alpha=0.5)
gp2 <- gp2 + xlab("Value of Ramanujan number") + ylab("Frequency")
# gp <- gp + facet_wrap(histology~.)
# gp2 <- gp2 + facet_grid(age~.)
gp2
ggsave(filename = "hist_ramanujan_numbers.eps", gp2,
device = "eps")#, useDingbats=FALSE)
gp2 <- ggplot(ramanujan_numbers, aes(x=log10(x)))
gp2 <- gp2 + geom_histogram()#alpha=0.5)
gp2 <- gp2 + xlab("log 10 of value of Ramanujan number") + ylab("Frequency")
# gp <- gp + facet_wrap(histology~.)
# gp2 <- gp2 + facet_grid(age~.)
gp2
ggsave(filename = "hist_ramanujan_numbers_log10.eps", gp2,
device = "eps")#, useDingbats=FALSE)