I use the ncdf
pacakge which I found to be much easier to install than the RNetCDF
package across operating systems (notably Linux and MacOS). To get the list of variables you simply:
library(ncdf)
nc = open.ncdf('example.nc')
variables = names(nc[['var']])