Programming Help



I am a relatively new R user, and I've developed a linear equation with constraints that I'm struggling to program into R for research on my data sets. I'm looking for some direct help on how to execute the correct commands. I've dug through youtube for instructional videos and there is great content there but in my inexperience I'm struggling to connect the dots. Any guidance would be a huge help.


Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

Right now the best way to install reprex is:

# install.packages("devtools")

If you've never heard of a reprex before, you might want to start by reading the help page. The reprex dos and don'ts are also useful.

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "")

For pointers specific to the community site, check out the reprex FAQ, linked to below.


Another tip: you’ll get more attention from people with the right expertise to help with your problem if you edit your Topic title to be a little more specific — e.g., “Programming a linear model with constraints”.

Even better would be “Programming a linear model with constraints using [name of package or function you are trying to use]”

(If you’re not sure how to edit your Topic, there’s a FAQ for that: FAQ: How do I edit my Topic or Post?)