The R button refers to the right shoulder button on the Wii U GamePad, the Nintendo 64, GameCube, Classic, and Wii U Pro Controllers, and on the Nintendo 3DS itself. Its purpose in Super Smash Bros. is to grab opponents. It is used in Melee and Brawl for defense techniques, such as shielding, rolling, air dodging in midair, and sidestep dodging, which is shared with the L button, while in Super Smash Bros. for Nintendo 3DS, it is used for shielding. In SSBU, it also refers to one of the shoulder buttons of the Pro Controller or the double Joy-Cons. (Not to be confusedd with the SR button). By default, it has the same functon as the L button, being used for grabbing and, while in the air, airdodging.
When using a single Joy-Con in SSBU, the L or R button (depending on which Joy-Con is used) is not set to any action by default. Instead, SL is used for grabbing and SR for shielding. In this configuration, the L or R button cannot be set to grab. They share this trait with the ZL or ZR button in said configuration.