...
PrincipalIDs do not have syn before them and do not use quotation marks.
Incomplete Code to Complete Tasks:
For non-programming types - Often the code provided above does not include a final line to run it.
For example, when removing access you need to a line that :
## after running the code above for removing a person's access to an entity, type this line with the correct entityID and principalID
removeAccess("syn123456","789012")
Using Python instead of R:
...