Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

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

Finance Feb 12, 2022

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 .]

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment