這個網誌中的熱門文章
using R tableExtra package
kableExtra testonly kableExtra testonly R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com . When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this: Using kableExtra package You can use kable function, for example: library(knitr) library(kableExtra) #options(knitr.table.format = "html") dt <- mtcars[1:5, 1:6] kable(dt) mpg cyl disp hp drat wt Mazda RX4 21.0 6 160 110 3.90 2.620 Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 Datsun 710 22.8 4 108 93 3.85 2.320 Hornet 4 Drive 21.4 6 258 110 3.08 3.215 Hornet Sportabout 18.7 8 360 175 3.15 3.440 dt %>% ka...
教你不用寫程式也能爬網路上的資料
要分析資料, 有時候需要用到網路上的資料, 這時就需要爬資料. 爬資料有很多種方式, 一般會用R 或Python 寫爬蟲程式來爬取資料. 今天教大家不用寫程式也能爬網路資料 只要用google sheets 一步就搞定. 如果我們想要知道今天 集中市場前10大進出券商淨買賣超前30名個股是那些, 一般我們都要google 去找, 或上網到某特定網站去點選查找, 如果想要紀錄分析就還要copy paste 的動作, 現在這些通通免了, 只要開啟google sheets 每天最新的資料就自動出現了~~~ 趕快來看怎麼做ㄅ…. 比如: 我們要爬取 https://www.cnyes.com/twstock/idx_main2/0000T.htm 裡的資料 開啟 google sheets 在任一cell內輸入: =IMPORTHTML("https://www.cnyes.com/twstock/idx_main2/0000T.htm","table",2) 輸入完後按enter 就完成了 存檔後, 每天一開啟這個檔案, 甚麼都不用做,最新的資料就自動show 在眼前, 是不是很方便?