You are reading data from a file that has a complex or irregular structure.
Solution
Use the readLines function to read individual lines; then process them as strings to extract data items.
Alternatively, use the scan function to read individual tokens and use the argument what to describe the stream of tokens in your file. The function can convert tokens into data and then assemble the data into records.
You want access to data stored in a MySQL database.
Solution
Install the RMySQL package on your computer.
Open a database connection using the dbConnect function.
Use dbGetQuery to initiate a SELECT and return the result sets.
Use dbDisconnect to terminate the database connection when you are done.
Discussion
This recipe requires that the RMySQL package be installed on your computer. That package requires, in turn, the MySQL client software. If the MySQL client software is not already installed and configured, consult the MySQL documentation or your system administrator.
Use the dbConnect function to establish a connection to the MySQL database. It returns a connection object which is used in subsequent calls to RMySQL functions:
library(RMySQL)
con <- dbConnect(MySQL(), user="userid", password="pswd",