B Appendix - Troubleshooting

As a first step, always ensure you are using the latest version of the motus package (see Appendix C.1), and you have all required packages installed, loaded, and up to date (see Chapter 2).

While attempting to download data with the motus package, you may encounter errors, many of which are likely due to an interrupted connection. Always ensure you are connected to the internet when using the tagme() function with update = TRUE. Most issues can be solved by either logging out of the motus package, or by restarting R and resuming the download using tagme(). If errors persist and you are unable to download your data, the server may be temporarily offline. Please contact Motus with any concerns at .

B.1 General Problems

Many, many, problems arise from conflicts between R packages which may be out of date. If you have a problem that you can’t seem to resolve, try the following steps in order (stopping when the problem goes away):

  1. Update motus and packages that motus depends on. (You may first need to install the remotes package). Re-start R
  1. Update all your packages. Re-start R
  1. Update R https://cran.r-project.org/. (You may have to reinstall packages)

B.2 Logging out of motus


B.3 Resume data download

To resume your data download, run tagme() again, but do not include new = TRUE:

tagme(project.num, update = TRUE, dir = ...)

B.4 Google Maps

As of October 16, 2018 recent updates require the use of a Google key to access google maps. To obtain an access key, you must be a registered Google user with up to date billing information, however you do not have to pay for the service (for the first little while at least). To obtain a key:

  1. login to the Google Cloud Platform.
  2. If you do not already have a project then create one.
  3. Check that you have current billing information - you will not be charged but it must be present and up to date.
  4. Under the navigation menu on the left, click APIs & Services > Credentials, then click Create credentials > API key.
  5. You may need to enable Google Maps Static API. You can do this through the navigation menu in the upper left corner, and selecting APIs & Services > library, choosing “Google Maps Static API” and clicking “Enable”.

Full details are listed under “Detailed Guide” here. Note that you may have to enable Google Maps Static API. For troubleshooting see here and here.

Once you have your access key, you’ll need to provide it with the call register_google(), each time you start a new R session you will be required to enter your key.

Then you can create Google maps with the ggmap package using the get_googlemap() function and specifying the lat/lon center of your map (as opposed to bounding box as with stamen maps).

B.5 Common problems and solutions:

B.5.1 I cannot access Project 176 / I download 0 records from Project 176

Remember that project 176 is only accessible with the username and password: motus.sample.

B.5.2 I get the message “Auto-disconnecting SQLiteConnection” one or multiple times after using tagme()

If this occurs after data download has finished, this message can be ignored. If it occurs during an active download, the connection will usually be maintained and the download will continue. However if the download stops, simply run tagme() again. If that does not work, we suggest logging out of the motus package or restarting R (see sections B.2 and B.3).

B.5.3 I get an “Internal Server Error” message when using tagme(…, update = TRUE)

If you get this message while updating your .motus file, use tagme() again to continue the download.

B.5.4 I get an “Error: Forbidden” message when using tagme()

This error may occur if you are attempting to download multiple projects simultaneously from the same user account. If you get this error, please logout of the motus package, and try tagme() again (see sections B.2 and B.3).

B.5.5 I get an error “Object ‘xxxx’ not found”, referring to a table or field name, or some of your examples in the book do not work.

Be sure to start the steps from the top of the chapter and run them in sequential order. Another possibility is that your .motus database hasn’t been updated to support the latest version of the motus package.

To ensure that your .motus file is up-to-date with the motus package:

sql.motus <- tagme(project.num, dir= ...)

To correct any warnings, you should follow these steps:

  1. download the latest version of the motus package (refer to Chapter 2).
  2. terminate and restart your R session.
  3. load the motus library using library(motus) in your R console.
  4. load your sqlite file. Look for notes on the console indicating that your database is being updated.
  5. check the version again.
sql <- tagme(project.num, dir= ...)

B.5.6 I get an error Error in rsqlite_connect(dbname, loadable.extensions, flags, vfs) : Could not connect to database: unable to open database file when attempting to run tagme()

If you get this message, it’s likely that you’re attempting a new download or update to a nonexistant directory. The directory is specified in the dir = "" command of the tagme() function. If the directory is not specified, files will be saved to your working directory. Use getwd() to determine your current working directory. Use setwd() to set a new working directory. To specify a location to save files from your working directory use “./” followed by the file path.

getwd() # show working directory, in this case it's "C:/Documents"

# downloads data to your working directory
tagme(proj.num, new = TRUE, update = TRUE)

# downloads data to the data folder within your working directory
# ie. the file path C:/Documents/data
tagme(proj.num, new = TRUE, update = TRUE, dir = "./data/") 

# downloads data to the file path C:/Downloads
tagme(proj.num, new = TRUE, update = TRUE, dir = "C:/Downloads") 

B.5.7 I see GPS coordinates of “0” or “999”

These values are recorded from the GPS unit in the field. Values like these should be ignored, you can replace these with NA, or insert the recvDeployLat/recvDeplOyLon values which are taken from receiver deployment metadata entered by users.

## to replace gpsLat/gpsLon values of NA, 0, or 999 with that of receiver deployment metadata in the alltags table, and read into a data.frame
df.alltags <- tbl.alltags %>% 
  mutate(recvLat = if_else((is.na(gpsLat)|gpsLat == 0|gpsLat == 999), 
                           recvDeployLat, gpsLat), 
         recvLon = if_else((is.na(gpsLon)|gpsLon == 0|gpsLon == 999), 
                           recvDeployLon, gpsLon)
  collect() %>% as.data.frame

B.5.8 I see port with a value of -1

Port “-1” represents the “A1+A2+A3+A4” compound antenna which is sometimes reported in Lotek .DTA file detections. This likely means the receiver has combined the signal from 4 antennas to detect the tag.

B.5.9 I get the error Error in rsqlite_fetch(res@ptr, n = n) : database disk image is malformed

This is likely due to corrupt files which can occur during download. The easiest solution is to delete your current .motus file and download from scratch.

Of course, there is always the possibility that the book contains errors! If this does not work, please contact .