Hi all, Firstly, it is not a homework. I am working for a hotel booking company in Thailand but I don't want to explain a complex equation and concept here so I keep it simple and closely related to what I am trying to solve.I apology if my question is not clear enough.
I am new to R and previously this problem can be solved easily in Excel using the "Goal Seek" tool. An example related to my question is when we use the PMT formula (in Excel) to find the loan payment amount for the given values of parameters i.e. interest rate, total number of payments, and principal amount of the loan. loan_payment_amt_of_each_period = PMT(interest_rate,total_number_of_payments,principal_amt) The question is when you know exactly on a monthly basis that you can afford only X amount of money to pay and you want to know how many months you have to do the payment given your monthly affordable money, the fixed interest rate, and the principal amount of loan. Using Goal Seek tool in Excel, it is like a backward solving for X given Y by not having to transform anything from the original equation. Simply put the loan_payment_amt_of_each_period you want and let the software calculate the total_number_of_payments for you. Thanks arun. But that was you solved the original equation and put it as a new formula to R to calculate the result which is easy as long as the original equation is not complex. Thanks you, Prakasit Singkateera On Mon, Feb 18, 2013 at 1:18 AM, Bert Gunter <gunter.ber...@gene.com> wrote: > Homework? We don't do homework here. > > -- Bert > > On Sun, Feb 17, 2013 at 5:10 AM, Prakasit Singkateera > <asltjoey.rs...@gmail.com> wrote: > > Hi Experts, > > > > I have a dataset of 3 columns: > > > > customer.name product cost > > John Toothpaste 30 > > Mike Toothpaste 45 > > Peter Toothpaste 40 > > > > And I have a function of cost whereby > > > > cost = 3.40 + (1.20 * no.of.orders^2) > > > > I want to do a backward calculation for each records (each customer) to > > find his no.of.orders and create a new column named "no.of.orders" in > that > > dataset but I don't know how to do. > > > > Please help me. > > > > Thank you everyone, > > Prakasit > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > -- > > Bert Gunter > Genentech Nonclinical Biostatistics > > Internal Contact Info: > Phone: 467-7374 > Website: > > http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.