Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:33:04+00:00 2026-06-09T00:33:04+00:00

Are there any R packages available that have some form of function that can

  • 0

Are there any R packages available that have some form of function that can calculate IRR based on uneven payments on specific dates for a lump sum distribution.

Example:

df <- data.frame(date = c(as.Date("2010-1-24"), as.Date("2011-5-6"), as.Date("2012-3-24")), pmts=c(-2000,-1000,-800))
today <- as.Date("2012-7-25")
lumpsum <- 4580

I’m looking for an easy way to calculate the rate of return of $4580 received today in exchange for the payment schedule defined above.

Thanks in advance,
–JT

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:33:06+00:00Added an answer on June 9, 2026 at 12:33 am

    As already noted in the comments it would be easier to write something simple:

    NPV<-function(paym,pdates,IRR){
       ptimes<-as.Date(pdates)-min(as.Date(pdates))
       ptimes<-as.numeric(ptimes,units="days")/365.25
       NPV<-sum(paym*(1+IRR)^{-ptimes})
       NPV
    }
    
    nlm(function(p){NPV(c(lumpsum,df$pmts),c(today,df$date),p)^2},p=0.1)
    

    gives a IRR of 11.26%

    EDIT:

    after a quick scout around the lifecontingencies package has a present value function if you want to use that instead.

    library(lifecontingencies)
    capitals<-c(lumpsum,df$pmts)
    times<-c(today,df$date)
    times<-as.Date(times)-min(as.Date(times))
    times<-as.numeric(times,units="days")/365.25
    presentValue(cashFlows=capitals, timeIds=times,interestRates=0.03)
    nlm(function(p){presentValue(capitals,times,p)^2},p=0.1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any packages that can take a directory full of source code (Objective-C
Are there any good packages for colour palettes in R that can handle many
Are there any open source (or I guess commercial) packages that you can plug
Are there any other similar packages that help identify and provide capabilities for browser
Is there any PHP PDF library that can replace placeholder variables in an existing
Is there any package that enables TCL to query MS SQL Server? I have
Are there any other packages for doing Venn diagrams in R besides the limma
Are there any R packages for the calculation of Kendall's tau-b and tau-c, and
Is there any way to disable certain metrics from selected packages in Sonar? I
There are several packages available for the usage of regular expressions in Haskell (e.g.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.