sqldf

    2熱度

    2回答

    有沒有什麼辦法可以把sqldf查詢放到用戶定義的函數中?我已經通過了這個:http://r.789695.n4.nabble.com/Passing-Multiple-Variable-Into-SQLDF-Statement-as-parameters-of-function-td4636147.html,R call variable inside sqldf。 我的示例代碼會是這樣的: db

    0熱度

    1回答

    我正在研究一個項目,在該項目中我必須將具有SIC行業分類的公司映射到相應的Fama-French行業分類。我發現Ian Gow優雅地創造了這個腳本。該腳本可從以下網址獲得:https://iangow.wordpress.com/2011/05/17/getting-fama-french-industry-data-into-r/ 但是,腳本或數據集中存在小故障,由於某些原因,它不適用於「Sic

    1熱度

    2回答

    我想運行sqldf()內的下列SQL語句: select columnA, "new_column_value" as columnB, "column.C" from mytable where columnA in ('123','456') 但是當我sqldf中運行: sqldf('select columnA, "new_column_value" as columnB, "colu

    2熱度

    3回答

    我在R中有2個數據幀,並且我想使用dataframe「y」參數對數據幀「x」執行查詢。 我有這樣的代碼: x <- c('The book is on the table','I hear birds outside','The electricity came back') x <- data.frame(x) colnames(x) <- c('text') x y <- c('b

    0熱度

    1回答

    我現在已經在爲r的數據幀稱爲DDS_LS。目前,每條線都是按交易處理的,但我需要由Customer_ID彙總的交易。 sqldf("SELECT Customer_ID, count(distinct Lifestyle), count(distinct Price_Point), cumsum(Delivered_Sales), cumsum(QTY_sold) FROM

    3熱度

    1回答

    我有這樣的一個表: 這是由下面的代碼生成: id <- c("1","2","1","2","1","1") status <- c("open","open","closed","closed","open","closed") date <- c("11-10-2017 15:10","10-10-2017 12:10","12-10-2017 22:10","13-10-2017 06:

    0熱度

    1回答

    我有一個數據框的列表,我想執行一個合併。我如何將列表中的每個元素傳遞給相應的sqldf語句? 我的代碼如下: require(sqldf) a <- data.frame(ID=c("a","b","c","d","a","a"),num=1:6,num2=2:7) b <- data.frame(ID=c("d","a","a","a","b","c"),num=6:1,num2=7:2)

    -1熱度

    1回答

    我有兩張客戶和訂單表,我想過濾出符合step1和step2需求的customer_id,而當我執行step2.5時,控制檯顯示 Error: Cannot pass NA to dbQuoteIdentifier() In addition: Warning message: In field_types[] <- field_types[names(data)] : number

    0熱度

    1回答

    我有一個csv文件,其中包含15個記錄,其中包含類別/子類別。 列:Main_category,Sub_category,計數 所需的結果:類別,Sub_cat1,50 我嘗試了使用Python大熊貓,並得到了上述結果: test = pd.DataFrame(df.groupby(['Main_category','Sub_category']['Sub_category'].count())

    0熱度

    1回答

    sessionInfo() [R版本3.4.1(2017年6月30日)平臺:x86_64的-PC-Linux的GNU(64位) 下運行:Ubuntu的LTS 16.04.3 矩陣產品:默認BLAS: /home/roughmar/anaconda3/lib/R/lib/libRblas.so LAPACK: /家庭/ roughmar/anaconda3/lib中/ R/lib/libRlapac