tpemartin / 110-2-R

The class repo for 110-2 Programming for Data Science
0 stars 3 forks source link

Animal shelter data import #8

Open tpemartin opened 2 years ago

tpemartin commented 2 years ago

Import the following data to R:

https://raw.githubusercontent.com/tpemartin/110-2-R/main/animal_shelter.json

The data is coming from the web crawling program https://github.com/tpemartin/110-2-R/blob/main/shelter_crawling.R.

What will you proceed from there?

Chious commented 2 years ago

410874212 社學三 邱佳昇

首先我利用library()的函數將處理json檔的packege "rjson"引入

接著利用fromJSON()讀取資料"'animal_shelter.json",並存入result中

接著我利用as.data.frame()將result轉成dataframe以利後續資料處理

library("rjson")

result <- fromJSON(file = 'animal_shelter.json') json_data_frame <- as.data.frame(result) print(json_data_frame)

Christychenn commented 2 years ago
jsonlite::fromJSON("https://raw.githubusercontent.com/tpemartin/110-2-R/main/animal_shelter.json",simplifyDataFrame = F) ->shelter_data
tpemartin commented 2 years ago

To make the program work, you need to

  1. Run Sys.getenv("PATH") in R.
  2. Install Chromedriver from https://chromedriver.chromium.org/home in one of the path you find in step 1.
  3. Install package processx.
  4. Run remotes::install_github("tpemartin/econWeb").
JWLee7 commented 2 years ago
jsonlite::fromJSON("https://raw.githubusercontent.com/tpemartin/110-2-R/main/animal_shelter.json",simplifyDataFrame = F) -> animalshelter
Chious commented 2 years ago

I've upload my notes on Notion: https://schiou.notion.site/animal_shelter_crawling-8d45ad62d3e94d908053e5c8b871fb00

2022.05.18 : 大約已經理解8~9成了,更細一步可能可以去理解glue() 或是 revest()的function是甚麼,或是不太理解為啥有些儲存位置需要一步一步來。