This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library("data.table") | |
| load("clean.neus.RData") | |
| s2c <- function (x, type = "list") | |
| { | |
| as.call(lapply(c(type, x), as.symbol)) | |
| } | |
| colsuwant <- c("depth","btemp","stemp","bsalin","ssalin") | |
| jho_cneus <- clean.neus[spp=="Paralichthys dentatus", structure(lapply(eval(s2c(colsuwant)),meanna, na.rm=TRUE),.Names=colsuwant),by=c("reg","datetime","year","stratum","lon","lat","haulid","season","station","spp","common")] | |
| setkey(jho_cneus, datetime, year, stratum, station) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============ | |
| # = Packages = | |
| # ============ | |
| # to do everything in this script, make sure the following packages are installed | |
| # install.packages(c("rgenoud", "strucchange")) | |
| # ============= | |
| # = Functions = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Read JHo | |
| #' | |
| #' Read in a file formatted like Jennifer's data sets | |
| #' | |
| #' @param file a character indicating the file name (and possibly path) | |
| #' @param n_nrows integer indicating number of rows for each matrix | |
| #' @param n_matrices integer indicating number of matrices in the file | |
| #' @param n_comment integer indicating the number of comment lines preceding each matrix of data; should include blank lines | |
| #' @param n_top_comment integer indicating the number of comment lines that are unique to the start of the file; default is 0 lines | |
| #' @param ... arguments to be passed to \code{scan}, such as \code{what=numeric()} and \code{sep=","} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Read JHo | |
| #' | |
| #' Read in a file formatted like Jennifer's data sets | |
| #' | |
| #' @param file a character indicating the file name (and possibly path) | |
| #' @param n_nrows integer indicating number of rows for each matrix | |
| #' @param n_matrices integer indicating number of matrices in the file | |
| #' @param n_comment integer indicating the number of comment lines preceding each matrix of data; should include blank lines | |
| #' @param n_top_comment integer indicating the number of comment lines that are unique to the start of the file; default is 0 lines | |
| #' @param ... arguments to be passed to \code{scan}, such as \code{what=numeric()} and \code{sep=","} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df <- data.frame(x = rnorm(20, mean=20, sd = 10)) | |
| threshold <- 25 | |
| replace_val <- 0 | |
| df[,"x2"] <- df[,"x"] # make them the same to start | |
| df[df[,"x"] >= threshold, "x2"] <- replace_val # replace values at or above threshold with replacement value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # for Eva (foreva eva) | |
| eg <- structure(c(608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, | |
| 608416320, 608416320, 608416320, 608416320, 608416320, 608416320, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## All R files that are used must be listed here: | |
| packages: | |
| - data.table | |
| - LaF | |
| - bit64 | |
| - stringr | |
| - stringi | |
| - PBSmapping | |
| - devtools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export PATH=$HOME/bin:$PATH | |
| source ~/.bashrc | |
| export PATH=$PATH:/usr/include | |
| source ~/.bashrc | |
| echo $PATH | |
| cd | |
| mkdir src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot(crop(subset(soda.annMax, 5:51), extent(c(-76, -65, 36, 46))), maxnl=200, bigplot=bgplt, smallplot=smplt, axis.args=axargs, col=tim.colors(), zlim=range(values(crop(subset(soda.annMax, 5:51), extent(c(-76, -65, 36, 46)))),na.rm=T)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zCol <- function(nCols, Z){ | |
| cols <- colorRampPalette(c("#000099", "#00FEFF", "#45FE4F", "#FCFF00", "#FF9400", "#FF3100"))(nCols) | |
| colVec_ind <- cut(Z, breaks=nCols) | |
| colVec <- cols[colVec_ind] | |
| } | |
| # Example | |
| X <- rnorm(1E3) | |
| Y <- rnorm(1E3) | |
| Z <- X*Y |