To update a package in R, you can use the install.packages() function with the update parameter set to TRUE. Here's the syntax:

install.packages('packageName', update = TRUE)

Replace 'packageName' with the name of the package you want to update.

For example, to update the dplyr package, you would use the following command:

install.packages('dplyr', update = TRUE)

This will check for updates to the package and install the latest version if available.

Note: In some cases, you may need administrative privileges to update packages installed in system directories. If you encounter an error, try running R or RStudio as an administrator.

How to Update R Packages: A Simple Guide