Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
content badge
swh:1:cnt:a8486ba948bf78049d14d56a89c50878221ca054

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
# Flags

require(dplyr)
require(ggplot2)
require(tidyr)
require(reshape2)
require(lemon)
require(plotly)
require(data.table)
require(geobr)
require(terra)
require(openxlsx)

rrs = read.xlsx('Data/rrs.xlsx', detectDates = T)


rrs$negatives = 0

for(i in 1:nrow(rrs)) {
  
  neg_value = rrs[i,-1] %>% t() %>% as.numeric() 
  
  rrs$negatives[i] = neg_value[neg_value < 0] %>% length()
  
}




waves = data.frame(WV = c(400:900))

waves$Neg_per_WV = NA

for(i in 2:ncol(rrs)) {
  
  wv = rrs[,i] %>% as.numeric() %>% na.omit()
  
  negativos = wv[wv < 0] %>% length()
  
  waves$Neg_per_WV[i] = negativos
  
  print(negativos)
  
}

par(cex = 2)
matplot(x = waves$WV, y = waves$Neg_per_WV, type = 'l', xlab = 'Wavelength (nm)', ylab = 'Number of Negative values')


## Plotar as flags

flags2 = fread('Data/flags.csv')

par(mfrow=c(1,2))
matplot(x = waves$WV, y = waves$Neg_per_WV, type = 'l', xlab = 'Wavelength (nm)', ylab = 'Number of Negative values')

df = data.frame(Baseline_Shift = sum(flags2$Baseline_shift),
                Oxygen_signal = sum(flags2$Oxygen_signal),
                Suspicious = sum(flags2$Suspicious),
                Noisy_red = sum(na.omit(flags2$Noisy_red), na.omit = T), 
                Negative = max(waves$Neg_per_WV,na.rm = T)) %>% melt()

require(ggplot2)

df$variable = gsub(df$variable, pattern = 'Baseline_Shift', replacement = "BS")
df$variable = gsub(df$variable, pattern = 'Oxygen_signal', replacement = "OS")
df$variable = gsub(df$variable, pattern = 'Noisy_red', replacement = "NR")
df$variable = gsub(df$variable, pattern = 'Negative', replacement = "Neg")
df$variable = gsub(df$variable, pattern = 'Suspicious', replacement = "Susp")

pt1 = ggplot(df, aes(x = variable, y = value, fill = variable)) +
  geom_bar(stat = "identity", color = 'black', linewidth = 2)  +
  labs(y = 'Number of Flagged Spectra', x = 'Flags') +
  scale_fill_manual(values =  c("#0000FF", "#F0E442", "#D55E00", '#FF0000', 'darkgreen')) +
  #scale_x_discrete(breaks = 1:7, labels = 1:7, expand = c(0, 0)) + # Expande o eixo X para garantir que apareçam todos os rótulos
  theme_bw() + 
  theme(panel.grid.major = element_line(colour = "#d3d3d3"),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        panel.background = element_blank(),
        text = element_text(family = "Tahoma"),
        axis.title = element_text(size = 30),
        axis.text.x = element_text(colour = "black", size = size_axis, margin = margin(10,10,10,10)),
        axis.text.y = element_text(colour = "black", size = size_axis, margin = margin(10,10,10,10)),
        axis.line = element_line(size = 2, colour = "black"),
        strip.text = element_text(size = 40)) + 
  theme(plot.margin = unit(c(4, 4, 4, 4), "lines")) + 
  guides(color = guide_legend(override.aes = list(size = 15))) +
  theme(legend.position = "none")

pt2 = ggplot(waves, aes(x = WV, y = Neg_per_WV, color = 'red')) +
  geom_line(color = 'red', linewidth = 1, cex = 0.5) +
  geom_point(color = 'red', linewidth = 1.5) +
  
  labs(y = 'Number of Negatives', x = 'Wavelength (nm)') +
  #scale_x_discrete(breaks = 1:7, labels = 1:7, expand = c(0, 0)) + # Expande o eixo X para garantir que apareçam todos os rótulos
  theme_bw() + 
  theme(panel.grid.major = element_line(colour = "#d3d3d3"),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        panel.background = element_blank(),
        text = element_text(family = "Tahoma"),
        axis.title = element_text(size = 30),
        axis.text.x = element_text(colour = "black", size = size_axis, margin = margin(10,10,10,10)),
        axis.text.y = element_text(colour = "black", size = size_axis, margin = margin(10,10,10,10)),
        axis.line = element_line(size = 2, colour = "black"),
        strip.text = element_text(size = 40)) + 
  theme(plot.margin = unit(c(5, 5, 5,5), "lines")) + 
  guides(color = guide_legend(override.aes = list(size = 15))) +
  theme(legend.position = "none")



a = ggarrange(pt1, pt2, nrow = 1)


ggsave(plot = a, filename = 'Outputs/Figures/flags.jpeg', 
       width = 20, height = 10, dpi = 200, units = 'in')




back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API