mrosenstein / mp3

0 stars 1 forks source link

Data.frame mutation #1

Open obaldwin opened 6 years ago

obaldwin commented 6 years ago

Hey-o, Mae,

Great work on joining the tables! Now that we're accessing the weather data for 2017 using the whately data, how would we convert that into a data.frame for joining?

obaldwin commented 6 years ago

I asked Professor Baumer and he answered the question through slack: Olivia Baldwin [2:49 PM] For turning a n R object into a data.frame, I understand that I would use the as.data.frame function to coerce it. However, when my group tries to turn the whately database data (from github via etl) into a dataframe that we plan to join to our sap data, even when we specify the layer we want (whately[["ops"]]), it won’t let us coerce it into a data frame. How do we fix it?

Ben Baumer [3:03 PM] What type of thing is whately? I think you need to do this step mac <- etl("macleish") %>% etl_update() whately <- mac %>% tbl("whately") %>% collect(n = Inf) See the lab: https://beanumber.github.io/sds192/lab-macleish.html

Olivia Baldwin [3:21 PM] whately is type src and holds the weather data that is updated every ten minutes. when I used the code you gave me, from lab 14, it gives this error and doesn’t run: No database was specified so I created one for you at: /var/folders/xx/z77x1ggd7q74zq55bhd77z8r0000gn/T//RtmpWWYK1x/file28862cc221be.sqlite3 Downloading 2 new files. 0 untouched. trying URL ’https://scidb.smith.edu/~macleish/WhatelyMet_Met_10min.dat'

Ben Baumer [3:27 PM] Yeah, so once you collect() the resulting object should be a data.frame. See the difference between the mac object and the whately object? Have you confused the two?

Olivia Baldwin [3:29 PM] it still gives the same error while it is running, so I haven’t been able to see whether or not is a data.frame

Olivia Baldwin [3:42 PM] This is the error it gives: Error in download.file(url, method = method, ...) : cannot open URL ’https://scidb.smith.edu/~macleish/WhatelyMet_Met_10min.dat' from the line etl("macleish") %>% etl_update()

Olivia Baldwin [4:00 PM] It works now, thanks for the tips

Woot-woot!