I'm trying to accomplish something that shouldn't be that difficult, yet it escapes my attempts.
So I have an R Data Frame
(df) which looks something like this:
df
MeanTemperature(ºC) Longitude Latitude Height FinalConsiderations
5 91ºW 152ºS 548m Slightly Cooler
16 185ºE 53ºN 722m Unchanged
22 16ºW 2ºS 206m Significantly Warmer
The dataframe is a result of a filtered analyzed data. The end product is an Excel (xlsx)
where the final column is the conclusion of the overall analysis. So, those steps are all taken care of, but these tables are rather large, so it would be nice to be able to color, for example, in RED where it says "Significantly Warmer"
.
I've tried using the workbook from said dataframe
wb <- loadWorkbook(file) #where file is the location path
Here I want to collect those cells where it reads 'Significantly Warmer' in red, and afterwards export the workbook to xlsx.
fo1 <- Fill(foregroundColor="red") # create fill object # 1
cs1 <- CellStyle(wb, fill=fo1) # create cell style # 1
sheets <- getSheets(wb) # get all sheets
But now I can't find a way of making a function in the wb setting where at the column
$FinalConsiderations == 'Slightly Cooler'
, the cells foreground is colored red, afterwards exporting to xlsx.