I'm not sure what you can pass application_name='test'as an argument dbConnectto RPostgreSQL (there is an optional argument options, but I could not figure out what data it expects).
An alternative would be to run the following SQL query immediately after opening the connection:
SET application_name='test'
, .