我正在使用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)
答案 0 :(得分:0)
你是说这个吗?
write.csv2(rddSelectDF,file="./your_folder/rddSelectDF.csv)
更改文件夹的名称
答案 1 :(得分:0)
你的意思是这样的?
rddSelectDF <- as.data.frame(rddSelect)
write.csv(rddSelectDF, file = "rddSelect.csv")