简体   繁体   中英

Printing multi-line R output from PHP

I am using venn() of gplots package of R and I want to print the intersections on php. I am executing R using exec() and printing the output, it only prints last lines of a.

library(gplots)
f <- list(a, b, c, d, e)

info<-venn(f)
aa<-attr(info, "intersections")
print(aa)

Take individual intersections and merge them in a single variable. You can try like this.

library(gplots)
f <- list(a, b, c, d, e)

info<-venn(f)
a<-attr(info, "intersections")$`A:B:C:D`
aa<-attr(info, "intersections")$`A:B:C:E`
aaa<-attr(info, "intersections")$`A:B:C:D:E`
a<-toString(paste(a,collapse=","))
aa<-toString(paste(aa,collapse=","))
aaa<-toString(paste(aaa,collapse=","))
x<-paste(a,aa,aaa,sep = "|")
print(x)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM