Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / FIN4230 Assignment 1 Q1(20 points):  In our Topic 1_Functions

FIN4230 Assignment 1 Q1(20 points):  In our Topic 1_Functions

Finance

FIN4230

Assignment 1

Q1(20 points)

In our Topic 1_Functions.R file (Example 1), I have mentioned that their code is incorrect from finance perspective. For example, under their original code, their function actually compute like: 

                                                            100                                           

 

 

However, the correct way should be

                                 100                                                                      

 

 

Please answer following two questions:

  1. Write a code, using the same parameters (e.g. cash flows, rates) as in this example 1, to correctly compute the NPV (as shown above the section equation). [You can use either R or Python (but not Excel®). You can use programming methods like functions, loop, etc.…] 
  2. Write a self-defined function to correctly compute NPV, assuming the general parameters are cash flows = c(CF0,CF1,CF2,CF3…,CFN) and rates = c(r0,r1,r2,r3…rM)

 

Q2 (10 points) 

In RStudio, please copy the following concatenate strings

mydata = c("This is me",

           "That my house",

           "Hello, world!")

Please use “regular expression” code to print out only last line (e.g. "Hello, world!")) [hint: use str_detect and $ or ^]

 

 

Q3 (Bonus 5 points)

In RStudio, please copy the follow concatenate strings 

mydata = c('Nancy Smith',

                  'is there any solution?',

      ".[{(^$|?*+",

       "coreyms.com",

        "321-555-4321",

        "123.555.1234",

       "123*555*1234")

 

Please use “regular expression” code to print out only phone numbers (e.g. last three items) [hint: use str_extract and \\d or .]

Option 1

Low Cost Option
Download this past answer in few clicks

18.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE