cassandra R将表格转换为逗号分隔

wbgh16ku  于 2022-11-05  发布在  Cassandra
关注(0)|答案(2)|浏览(143)

我正在使用RStudio连接cassandraDB表数据并对其进行关联规则建模。我想在关联规则模型中使用这些表数据所以我想将此表转换为逗号分隔!
这里是获取表列和数据的代码:

> rddSelect <- select(rdd, customersegment, productcategory, region)
> typeof(rddSelect)
 [1] "list"
> rddSelect

# Source:   lazy query [?? x 3]

# Database: spark_connection

    customersegment productcategory   region
            <chr>           <chr>    <chr>
    1        Consumer       Furniture   Quebec
    2       Corporate Office Supplies   Prarie
    3       Corporate Office Supplies   Prarie
    4       Corporate Office Supplies     West
    5     Home Office Office Supplies     West
    6        Consumer Office Supplies   Quebec
    7     Home Office       Furniture   Prarie
    8  Small Business Office Supplies   Quebec
    9        Consumer      Technology Atlantic
    10     Home Office      Technology   Prarie
      # ... with more rows
    > rddSelectDF <- data.frame(rddSelect)
mfpqipee

mfpqipee1#

你是说这个吗?

write.csv2(rddSelectDF,file="./your_folder/rddSelectDF.csv)

更改文件夹的名称

gfttwv5a

gfttwv5a2#

你是说像这样的东西吗

rddSelectDF <- as.data.frame(rddSelect)
 write.csv(rddSelectDF, file = "rddSelect.csv")

相关问题