# NOT RUN {
# This should work...
if (package('tools', 'methods', stop = FALSE)) message("Fine!")
# ... but this not (note that there are no details here!)
if (!package('tools', 'badname', stop = FALSE)) message("Not fine!")
# }
# NOT RUN {
# Get an error
package('badname')
# }
Run the code above in your browser using DataLab