-
Notifications
You must be signed in to change notification settings - Fork 2
/
Forms_Dictionary.Rmd
103 lines (77 loc) · 3.72 KB
/
Forms_Dictionary.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
title: "ExampleForms"
author: "Wells"
date: "7/22/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(knitr)
library(readr)
library(dict)
library(fs)
```
```{r}
# Import csv's as a dict
#tessting
forms_dict<-dict()
for (i in 0:495){
name<-paste( "Form_Data/",toString(i),"forms0.csv" , sep = "")
if (file.exists(name)==TRUE){
forms[[i]]<-read_csv(name,col_names = FALSE)
}
}
```
```{r}
# Imprt csv's as one data frame
mydir = "Form_Data/"
files<-dir_ls(mydir)
forms<-files %>% map_dfr(read_csv, col_names = F, col_types = cols(.default = "c"))
```
```{r}
#Rename columns
forms <- as_tibble(forms)
forms<-rename(forms, form = X1, hash = X2, inverse = X3, dinverse = X4, rank = X5, PF = X6, rank_diff = X7, stablity = X8, tries = X9)
```
```{r}
#Treat rank and pfaffian as numbers
forms<- forms %>% mutate(rank = as.numeric(rank), PF = map_dbl(PF, ~eval(parse(text = .x))), stablity = as.numeric(stablity), tries = as.numeric(tries), rank_diff = as.numeric(rank_diff))
```
```{r}
ori_forms <- forms %>% filter(tries == 0)
#ggplot(aes(x = rank))+geom_histogram(binwidth = 5)
```
```{r}
ori_forms %>% count(rank, stablity) %>% group_by(rank) %>% mutate(prop = n/ sum(n)) %>% filter(stablity == 0) %>% mutate(prop = 1-prop) %>% ggplot(aes( x = rank, y = prop)) +
geom_point() +
theme_bw()
```
```{r}
ori_forms %>% count(rank, stablity) %>% group_by(rank) %>% mutate(prop = n/ sum(n)) %>% filter(stablity == -1) %>% mutate(prop = 1-prop) %>% ggplot(aes( x = rank, y = prop)) +
geom_point() +
geom_smooth() +
theme_bw()
```
```{r}
forms_invert<-forms %>% count(rank, invertible) %>% group_by(rank) %>% mutate(prop = n/ sum(n))
forms_invert %>% filter(invertible =="True") %>%
ggplot(aes( x = rank, y = prop)) +
geom_point()+
geom_smooth()
```
```{r}
forms_stable<-forms %>% count(rank, stable) %>% group_by(rank) %>% mutate(prop = n/ sum(n))
forms_stable %>% filter(stable =="True") %>%
ggplot(aes( x = rank, y = prop)) +
geom_point()+
geom_vline( xintercept = 32)+
geom_smooth()
```
```{r}
forms_pf<-forms %>% filter(PF > -2 & PF < 5 )
forms_pf %>% ggplot( aes ( x = PF)) + geom_histogram(bins = 20, color = "white")
```
```{r}
forms_538<-forms_pf %>% filter(form == "(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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