Thank you for your thorough reply.
I made a portfolio consisting of 30 stocks, and I am assigning weights . This is what I did:
tickers <- c("BAC","AAPL","AXP","TGT","COST","MCO","EL","COF","IBM","GS","JPM","KO","INTC","JNJ","JPM","TSLA","DFS","ABT","MA","MRK","MSFT","NKE","PFE","PG","TRV","UAL","SCHW","WMT","XOM","JBLU")
I got the symbols defined start and end dates, selected adjusted prices.
But now I want to use the function add.constraint for limiting fractional shares. How should I do it? I am relatively new and learning how to use R Studio. So, I would very much appreciate your help. I also had one more question, how can I allocate cash in portfolio? For instance, I want to say that 2000 dollars will be allocated to buy shares of Bank of America (BAC)? How would I do it using functions?