This file contains 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
[docker@a715cb8d440c /]$ R | |
> install.packages("classInt") | |
trying URL 'https://cran.cnr.berkeley.edu/src/contrib/e1071_1.7-2.tar.gz' | |
Content type 'application/x-gzip' length 583003 bytes (569 KB) | |
================================================== | |
downloaded 569 KB | |
trying URL 'https://cran.cnr.berkeley.edu/src/contrib/classInt_0.4-1.tar.gz' | |
Content type 'application/x-gzip' length 19048 bytes (18 KB) | |
================================================== |
This file contains 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
"C:\Program Files\R\R-3.5.1\bin\Rscript.exe" "thisfile.R" | |
ECHO *** Press Any Key to Continue *** | |
PAUSE >NUL |
This file contains 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
## copied from https://github.com/r-lib/rprojroot/blob/master/R/thisfile.R | |
thisfile_rscript <- function() { | |
cmd_args <- commandArgs(trailingOnly = FALSE) | |
if (!grepl("^R(?:term|script)(?:|[.]exe)$", basename(cmd_args[[1L]]), ignore.case = TRUE)) { | |
return(NULL) | |
} | |
cmd_args_trailing <- commandArgs(trailingOnly = TRUE) | |
leading_idx <- | |
seq.int(from = 1, length.out = length(cmd_args) - length(cmd_args_trailing)) |
This file contains 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
## Author: behrica | |
##' url{https://github.com/davidgohel/ReporteRs/issues/68} | |
##' Creates a docx file with the FlexTable objecta and a caption | |
##' | |
##' @param ft The FlexTable to add to the doxc file | |
##' @param docxFile Path of the docx file to create | |
##' @param caption The caption text to put above the table | |
##' @export | |
makeDocxWithFt <- function(ft,docxFile,caption) { |
This file contains 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
require(rgdal) | |
require(sp) | |
#' Overlay x,y coordinate (longitude, lattitude) with a polygon shapefile (shpfile) to get polygon id (id_name) | |
#' | |
#' @param xy.df A data frame with x and y columns for longitude and lattitude. | |
#' @param shpfile Full path name of a polygon shapefile. | |
#' @param id_name Name of the polygon shapefile id attribute | |
#' @param xy.epsg EPSG of the x, y coordinate |
This file contains 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
#! /usr/bin/env python | |
""" | |
This module provides classes for querying Google Scholar and parsing | |
returned results. It currently *only* processes the first results | |
page. It is not a recursive crawler. | |
""" | |
# Version: 1.3 -- $Date: 2012-02-01 16:51:16 -0800 (Wed, 01 Feb 2012) $ | |
# | |
# ChangeLog | |
# --------- |
This file contains 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
#! /usr/bin/env python | |
from random import randint | |
def random_chromosome(): | |
return [randint(0, 1) for i in range(32)] | |
def calc_fitness(chromo): | |
return sum(chromo) |
This file contains 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
-- 1. change storage engine for existing tables | |
-- reference: http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html | |
ALTER TABLE t ENGINE = MYISAM; | |
ALTER TABLE t TYPE = BDB; |
This file contains 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
-- 1. median() | |
-- http://www.postgresonline.com/journal/archives/67-Build-Median-Aggregate-Function-in-SQL.html | |
CREATE OR REPLACE FUNCTION array_median(numeric[]) | |
RETURNS numeric AS | |
$$ | |
SELECT CASE WHEN array_upper($1,1) = 0 THEN null ELSE asorted[ceiling(array_upper(asorted,1)/2.0)] END | |
FROM (SELECT ARRAY(SELECT ($1)[n] FROM | |
generate_series(1, array_upper($1, 1)) AS n | |
WHERE ($1)[n] IS NOT NULL | |
ORDER BY ($1)[n] |