'how to solve an equation like below in R

The equation is quite simple, but how to solve it in R is my question:

Return_of_A = 0.001431
Return_of_B = 0.000703
Return_of_C = 0.000716

the question is to create a portfolio that gives a return equal to the expected return of A (0.001431)

Return of a portfolio = Weight(A) * Return_of_A + 
                        Weight(B) * Return_of_B + 
                        Weight(C) * Return_of_C

How could I find the weight for each in R?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source