cpsievert / pitchRx

Tools for scraping MLB Gameday data and Visualizing PITCHf/x
http://cpsievert.github.io/pitchRx/
Other
124 stars 33 forks source link

having data.frame and variable issues #24

Closed cidawkins closed 9 years ago

cidawkins commented 9 years ago

I love pitchRx but now I'm having a little trouble once I get to the 2013 season. In particular, originally started on 2013-03-22, it said that it was unable to copy to the database connection and then it would export the csv file. I looked at the csv file, compared to the previous years that went through fine, and it seems that it parsed out a few extra fields in the pitch (play_guid), action (event_es, event2_es), and atbat (event_es, event2_es, event3_es).

I altered the pitch_export, atbat_export, and action_export tables to add these fields to the table. This solved the first issue of being able to copy to the database connection.

Now I have all the correct data in the *_export tables but it did not insert it into the regular tables. It gave the me following warning (over 50) on each line:

1: In export(connect, name = i, value = tables[[i]], template = fields[[i]]) : The value data.frame has variables that are not in the corresponding table. Writing data.frame to a new table instead.

Here is my session info: R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit)

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] pitchRx_1.6 ggplot2_1.0.0 RMySQL_0.10.2 DBI_0.3.1

loaded via a namespace (and not attached): [1] bitops_1.0-6 colorspace_1.2-5 digest_0.6.8 grid_3.1.2 gtable_0.1.2 hexbin_1.27.0
[7] lattice_0.20-29 MASS_7.3-35 Matrix_1.1-4 mgcv_1.8-3 munsell_0.4.2 nlme_3.1-118
[13] plyr_1.8.1 proto_0.3-10 Rcpp_0.11.4 RCurl_1.95-4.5 reshape2_1.4.1 scales_0.2.4
[19] stringr_0.6.2 tcltk_3.1.2 tools_3.1.2 XML_3.98-1.1 XML2R_0.0.6

I imagine that this came up before but I did not see it in your blog or in the issue list before.

Any help would be much appreciated.Thank you.

cidawkins commented 9 years ago

never mind. I fixed it.