Exporting to excell with highlighted changes
1
0
Entering edit mode
@patrick-schorderet-6146
Last seen 11.2 years ago
Dear All, I'm trying to compare two tables in R and find the differences between them (what has the user changed). The approach is the following: - Import .xls table into matrices - compare matrixes (and highlight differences) - output the 'new' table, with highlighted differences I can do all of this in R pretty easily, but the people I'm working with need a .xls file in return, with the highlighted changes (for example fill the cells which have changed with a color, or make them bold, etc). Any ideas?? Thanks for the help, Patrick PS: Here's the small script I have wrote so far. Ideally, M should carry some metadata around highlighting the differences I have applied. library(compare) library(gdata) # Load .xls file LoadXLSXFile <- function(file_name){ X <- as.matrix(read.xls(paste("./Desktop/", file_name, sep=""))) return(X) } # Two matrices A and B of equal size A<-LoadXLSXFile("A.xlsx") B<-LoadXLSXFile("B.xlsx") M <- A booT <- which((A==B)==TRUE) M[booT] <- "" write.table(M, "./Desktop/ComparedOutput.xls", sep="\t", col.names = F, row.names = F)
• 985 views
ADD COMMENT
0
Entering edit mode
Dan Tenenbaum ★ 8.2k
@dan-tenenbaum-4256
Last seen 17 months ago
United States
Hi Patrick, You might try the R-help list (https://stat.ethz.ch/mailman/listinfo/r-help) as this is not really a Bioconductor question. Dan ----- Original Message ----- > From: "Patrick Schorderet" <patrick.schorderet at="" gmail.com=""> > To: bioconductor at stat.math.ethz.ch > Sent: Thursday, September 12, 2013 5:36:50 AM > Subject: [BioC] Exporting to excell with highlighted changes > > Dear All, > I'm trying to compare two tables in R and find the differences > between them (what has the user changed). The approach is the > following: > - Import .xls table into matrices > - compare matrixes (and highlight differences) > - output the 'new' table, with highlighted differences > I can do all of this in R pretty easily, but the people I'm working > with need a .xls file in return, with the highlighted changes (for > example fill the cells which have changed with a color, or make them > bold, etc). > Any ideas?? Thanks for the help, > Patrick > PS: Here's the small script I have wrote so far. Ideally, M should > carry some metadata around highlighting the differences I have > applied. > > library(compare) > library(gdata) > > # Load .xls file > LoadXLSXFile <- function(file_name){ > X <- as.matrix(read.xls(paste("./Desktop/", file_name, sep=""))) > return(X) > } > > # Two matrices A and B of equal size > A<-LoadXLSXFile("A.xlsx") > B<-LoadXLSXFile("B.xlsx") > M <- A > booT <- which((A==B)==TRUE) > M[booT] <- "" > write.table(M, "./Desktop/ComparedOutput.xls", sep="\t", col.names = > F, row.names = F) > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD COMMENT

Login before adding your answer.

Traffic: 564 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6