Hello Jindra
Many thanks for your help. The information was very useful. Unfortunately, the "sf" library fails to load in my RStudio though the programme has been installed. Thus, I used the "sp" function which did work. Below is my code
data <- raster("wa12clmN_eraint_ctrl_tas_1980_2009_DAYMEAN.nc") # your ncdf file
borders <- readRDS("F:/DISSERTATION FOLDER/rcm_data/gadm36_GHA_1_sp.rds") # country borders in sf format
plot(borders)
plot(data) # the big picture
data_masked <- mask(data, borders) ##mask the unwanted areas
tempgh <- plot(data_masked, main = "Temperature anomaly of Ghana") # the small picture
With these outputs, I can rework my data and hopefully produce better temperature maps. Really grateful for your help and would reach out should I have any dilemma