Rhode Island has a “semi-closed” party primary system. This means that you may only vote in your party's primary, but if you are registered as "unaffiliated" you may vote in the primary of any party you choose. Once you vote in a primary, however, you are considered a member of that party until and unless you "disaffiliate."
You can check your current voter status and party affiliation at the Secretary of State’s Voter Information Center website. There, you can also edit your voter record to change your party affiliation if you desire. Disaffiliation from any party must take place at least 29 days before the primary date (i.e., by Monday, August 7 in order to take effect for the September 5 Primary Election).