[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
入門(寫過其他程式,只是對語法不熟悉)
[問題敘述]:
目前我有A、B兩個table
我想做一件事是把兩個table先join成C,這部分沒問題我用merge
之後我想當item欄位是空值時把text的資料擷取出部分
text的資料是url類似
utm_source=apple&utm_campaign=PRO&utm_medium=banner&text_id=12228473&date=
970101&loc=65173194cbfdbb89e06742a196ec150f
我想把各別的字串丟進資料庫的欄位中
例如:
apple 丟進source欄位
PRO丟進campaign欄位
banner丟進medium欄位
65173194cbfdbb89e06742a196ec150f丟進loc欄位
但是text_id我沒有設欄位,所以不需要解析
[程式範例]:
if(C$item == "") {C$apple <- C$text}
我本來是想說先丟進去再拆解,可是我連這個最基礎的都ERROR
the condition has length > 1 and only the first element will be used
想問一下這怎麼處理
[環境敘述]:
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Chinese (Traditional)_Taiwan.950 LC_CTYPE=Chinese (Traditional)_Taiwan.950
[3] LC_MONETARY=Chinese (Traditional)_Taiwan.950 LC_NUMERIC=C
[5] LC_TIME=Chinese (Traditional)_Taiwan.950
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RPostgreSQL_0.4-1 DBI_0.6
loaded via a namespace (and not attached):
[1] tools_3.3.3
[關鍵字]:
ETL