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

https://doi.org/10.5281/zenodo.14318846
17 December 2024, 12:45:03 UTC
  • Code
  • Branches (0)
  • Releases (1)
  • Visits
    • Branches
    • Releases
      • 1
      • 1
    • c8b2287
    • /
    • combining-hmm-and-ssf-code
    • /
    • scripts
    • /
    • add_standardised_cols_to_all_fish.R
    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
    • directory
    • snapshot
    • release
    origin badgecontent badge
    swh:1:cnt:bc91e5ddf92d2da698dcb795b779cf6abdfa809b
    origin badgedirectory badge
    swh:1:dir:30ac199afd3b1d7a0d0bdca02408cfa6e4b4363a
    origin badgesnapshot badge
    swh:1:snp:05a2af42b588522ca08f036c1f785d8457dcf25e
    origin badgerelease badge
    swh:1:rel:aa35d9e39d94cbf3f73362c2c2b5cd04c355e955

    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
    • directory
    • snapshot
    • release
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    Generate software citation in BibTex format (requires biblatex-software package)
    Generating citation ...
    add_standardised_cols_to_all_fish.R
    #file to add standardised columns to all fish for modelling and save
    
    ####clear variables####
    rm(list=ls())
    
    ####packages####
    
    library(dplyr)
    
    ####read in data####
    
    files <- list.files("data/find ladder/FINAL final SSF dataframes - filtered - decision tree/",full.names = T)
    
    stand <- read.csv("summary_stats_for_standardising.csv")
    
    #list variables
    variable_list <- stand$Variable
    
    ####loop####
    
    for (k in 1:length(files)){
      data_ssf <- read.csv(paste0(files[[k]]))
      id <- data_ssf$fish_id[1]
    
      
      #save number of columns for later
      num_cols <- length(data_ssf)
      if(length(data_ssf$approach)>0){
        for(i in 1:length(variable_list)){
          var <- variable_list[i]
          r0w <- filter(stand,Variable==var)
          col_id <- (num_cols+i)
          data_ssf[col_id] <- 0
          data_ssf[col_id] <- unlist((data_ssf[var]-r0w$Mean)/r0w$Std..Dev.)
          names(data_ssf)[col_id] <- paste0(var,"_strdised")
        } 
        write.csv(data_ssf,file=paste0("data/find ladder/FINAL final SSF dataframes - standardised and filtered - decision tree/",id,".csv"))
        
      } else {
          print(paste0("fish id ", files[[k]]," has no data left post filtering"))
        }
      
    }
    
    
    

    back to top

    Software Heritage — Copyright (C) 2015–2025, 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