Closed rempsyc closed 1 year ago
I have a solution for this, but I've created it with openxlsx2. (It could be backward compatible, but I haven't checked it.)
I exported both the correlation matrix and the p value matrix and created numeric styles for all required styles, e.g. negative correlation with **
. That keeps the actual values untouched.
Later I'll post my solution as a discussion in openxlsx2. It's not really something we should provide in the package, but something you can implement in your export function.
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
I am the author of the
rempsyc
package and one of the package's function (cormatrix_excel
) relies onopenxlsx
to export a formatted correlation matrix to Excel. Some users have made the request to include significance stars or p-values in the exported Excel file like other popular software/packages do. It currently does not because it relies on the numeric value of the cells to do conditional formatting (i.e., colour of the cells).I would like to export to Excel a correlation table with correlation coefficients as well as e.g., significance stars, while colouring cells based on the size of the correlation coefficients.
Thus, I would like to be able to either ignore certain characters (e.g., significance stars "***") when processing the cells with
conditionalFormatting
, or to be able to add them as extra information in the cells, separately (e.g., based on a separate dataframe of p-values).Alternatives include using the
apaTables
orcorrelation
packages, though they don't export to Excel. Else, it is possible to userempsyc::cormatrix_excel
but it won't have the p-values or stars.Reprex:
Created on 2022-07-28 by the reprex package (v2.0.1)
So the ideal result would be a mix of options 2 and 3 of this reprex, i.e., an Excel table including coloured correlation coefficients but that would also include significance stars.
Is there any way to do this? That is, to add information not contained in the actual cells?