-
Notifications
You must be signed in to change notification settings - Fork 3
/
ui.R
101 lines (91 loc) · 3.71 KB
/
ui.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
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
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application
shinyUI(fluidPage(
# Application title
titlePanel("Fixed rate mortgage calculator"),
# Sidebar for mortgage details
sidebarLayout(
sidebarPanel(
fluidRow(
h3("General"),
numericInput("borrow",
"Borrowing (£)",
value = 100000),
numericInput("period",
"Fixed period (years)",
value = 2),
hr(),
h3("Mortgage 1"),
numericInput("fee_1",
"Fee (£)",
value = 0),
numericInput("interest_rate_1",
"Interest rate (%)",
value = 2.2),
numericInput("repayment_pcm_1",
"Monthly repayment (£)",
value = 500),
hr(),
h3("Mortgage 2"),
numericInput("fee_2",
"Fee (£)",
value = 0),
numericInput("interest_rate_2",
"Interest rate (%)",
value = 3),
numericInput("repayment_pcm_2",
"Monthly repayment (£)",
value = 500),
hr(),
h3("Mortgage 3"),
numericInput("fee_3",
"Fee (£)",
value = 0),
numericInput("interest_rate_3",
"Interest rate (%)",
value = 2.5),
numericInput("repayment_pcm_3",
"Monthly repayment (£)",
value = 500),
hr(),
h3("Mortgage 4"),
numericInput("fee_4",
"Fee (£)",
value = 0),
numericInput("interest_rate_4",
"Interest rate (%)",
value = 3.1),
numericInput("repayment_pcm_4",
"Monthly repayment (£)",
value = 500)
)),
mainPanel(
fluidRow(
# Show a plot of the costs
h3("Plot of interest cost over the fixed term period"),
plotOutput("costPlot"),
# Show table of the costs
h3("Table of interest cost over the fixed term period"),
formattableOutput("formattable"),
# Description
h3("About"),
p("This is an app to calculate and compare the cost of four mortgages. These mortgages need to be fixed rate and the fixed rate needs to be over the same term. Use the app to see whether paying a fee for a lower interest rate will save you money."),
p("This app is issued with no warranty (see licence on GitHub). Please consult a specialist financial advisor."),
hr(),
p(a("Created by Mike Spencer",
href = "https://twitter.com/MikeRSpencer",
target = "_blank")),
p(a("Code available on GitHub",
href = "https://github.com/mikerspencer/mortgage_calc",
target = "_blank"))
))
)
))