I would like to ask a question about package licenses in R. I have a package in R (in GitHub), and I offer a course on how to use it, as well as other topics in my professional field, which have been selling a lot. However, I came across a copy of my course, using the package I created, without being consulted. Is there any way to restrict commercial use of my package exclusively for courses (but without excluding other commercial uses)? I researched but I didn't find a clear answer about it...
Is there any way to restrict commercial use of my package exclusively for courses (but without excluding other commercial uses)?
Such a restriction is only possible when you (ask a lawyer to) create your own license. But such a license will not be considered an open-source license and it will hinder adoption of your package by others.
However, there is also another route. Under copyright law, the R package and the course materials are completely separate things and they can be licensed independently.
For example, you can license the R package under an open-source license and at the same time license the course materials under the CC BY-NC-ND license (which is not an open-source license as it forbids commercial use and the making of derivative works).