I have data for 40 buildings. Each building contains folders like CO2, Temperature, heat. then inside each folder there is data for different regions of house. For instance, for CO2, I have data (time series collection) for hallway, bedroom, living room etc. I need heatmaps for all these data file. So far, what i could do is, I wrote a code to go inside each directory, then each folder and then access files and draw heatmap inside Rstudi. Code is:
setwd("C:/Users/...")
folders <- list.dirs(full.names = TRUE)
result <- sapply(folders[-1], function(x){
res<-lapply(files, function (x) {
[some heatmap function]
P1<- ggplot(df, aes(Time, Date, fill =reading)) + geom_tile(colour = "grey") + scale_fill_gradientn(colours=c("darkblue", "red", "yellow"), values=rescale(c(0, 1000, 2000)), guide="colorbar")+scale_x_discrete(breaks = lab1)
plot(P1)
})})
what i actually want is, to store the heatmap results of each file in the same folder with the name of the folder+name of the file (like CO2.hallway.jpeg etc). I am trying various codes since last 2 days but none is working for me. can anyone please help me with this. I'll very grateful to you.