Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
acts-875
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Corder
acts-875
Commits
03928d02
Commit
03928d02
authored
5 years ago
by
Carl Corder
Browse files
Options
Downloads
Patches
Plain Diff
write transformed data to excel
parent
8cd46513
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/phase2/transform_data.r
+13
-8
13 additions, 8 deletions
scripts/phase2/transform_data.r
with
13 additions
and
8 deletions
scripts/phase2/transform_data.r
+
13
−
8
View file @
03928d02
library
(
"readxl"
)
library
(
"writexl"
)
library
(
"dplyr"
)
# Phase 2 Excel
# https://unl.box.com/s/4dfo4iv2n8awiqt20himu24kyhtmgavk
fileName
<-
"C:/Users/its-student/Desktop/Phase2.xlsx"
input
<-
"C:/Users/its-student/Desktop/Phase2In.xlsx"
output
<-
"C:/Users/its-student/Desktop/Phase2
Out
.xlsx"
# read in sheets
data
<-
read_excel
(
fileName
,
sheet
=
"Data"
)
commission
<-
read_excel
(
fileName
,
sheet
=
"Commission"
)
# by group and policy duration
expense
<-
read_excel
(
fileName
,
sheet
=
"Expense"
)
# bin by annualized net premium
rtn
<-
read_excel
(
fileName
,
sheet
=
"RTN"
)
sic
<-
read_excel
(
fileName
,
sheet
=
"SIC"
)
tax
<-
read_excel
(
fileName
,
sheet
=
"Tax"
)
data
<-
read_excel
(
input
,
sheet
=
"Data"
)
commission
<-
read_excel
(
input
,
sheet
=
"Commission"
)
# by group and policy duration
expense
<-
read_excel
(
input
,
sheet
=
"Expense"
)
# bin by annualized net premium
rtn
<-
read_excel
(
input
,
sheet
=
"RTN"
)
sic
<-
read_excel
(
input
,
sheet
=
"SIC"
)
tax
<-
read_excel
(
input
,
sheet
=
"Tax"
)
# drop reserves not related to STD (IBNR)
data
<-
data
%>%
select
(
-
c
(
ICOS
,
WAIVER_IBNR
,
GAAP_RESV
,
WAIVER_RESERVE
))
...
...
@@ -97,3 +98,7 @@ data <- data %>% mutate(ACTUAL_CLAIMS = PAID_CLAIMS + IBNR)
# calculate actual to expected ratio
data
<-
data
%>%
mutate
(
ACTUAL_TO_EXPECTED
=
ACTUAL_CLAIMS
/
EXPECTED_CLAIMS
)
# write data to Excel
write_xlsx
(
data
,
path
=
output
,
col_names
=
TRUE
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment