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
> set.seed(1) | |
> шушумига <- rnorm(10) | |
> шушумига | |
[1] 0.7996718 -0.9688060 -0.1634763 -1.1242522 -1.5689024 -0.6055469 | |
[7] -0.3446827 -0.8229724 -0.6148953 2.5545790 | |
> set.seed(1) | |
> ( blah <- factor(sample(c("један", "два", "три"), 100, replace = TRUE)) ) | |
[1] један два два три један три три два два један један један | |
[13] три два три два три три два три три један два један |
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
corstar <- function(x, y = NULL, use = "pairwise", method = "pearson", round = 3, row.labels, col.labels, ...) { | |
require(psych) | |
ct <- corr.test(x, y, use, method) # calculate correlation | |
r <- ct$r # get correlation coefs | |
p <- ct$p # get p-values | |
stars <- ifelse(p < .001, "***", ifelse(p < .01, "** ", ifelse(p < .05, "* ", " "))) # generate significance stars | |
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
// homepage = "http://www.google.com"; | |
// set default webjump | |
read_url_handler_list = [read_url_make_default_webjump_handler("google")]; | |
// possibly valid URL | |
function possibly_valid_url (str) { | |
return (/[\.\/:]/.test(str)) && | |
!(/\S\s+\S/.test(str)) && | |
!(/^\s*$/.test(str)); | |
} |
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
grade_questionnaire <- function(dtf, n.items, item.ind = NULL, scale.names, scale.labels = NULL, start = 1:length(scale.names), end = n.items, jump, rev.ind = NULL, rev.fn = NULL, total = FALSE, total.name = NULL, allowed.values = NULL, pre.process.fn = NULL, na.rm = FALSE, ...){ | |
d <- subset(dtf, ...) # create subset if any | |
nc <- ncol(d) # number of columns | |
## number of columns sanity check | |
if (nc != n.items) | |
stop(sprintf("Incorrect number of items! %d items required, while %d were provided!", n.items, nc)) | |
## check scale labels |
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
;; start the timer | |
(defvar *emacs-load-start* (current-time)) | |
;; Package repos | |
(require 'package) | |
;; MELPA | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(package-initialize) | |
(global-set-key (kbd "C-c p") 'list-packages) |
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
#!/bin/bash | |
FILEBASE=${1%.*} | |
FILEXT=${1##*.} | |
FILEPATH=${1%/*} | |
TEXFILE=$FILEBASE.tex | |
PDFFILE=$FILEBASE.pdf | |
# errorexit |
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
#!/bin/bash | |
if [ -z $(lsmod | grep vboxdrv) ]; then | |
# load virtualbox module | |
gksudo modprobe vboxdrv | |
fi | |
# virtualbox module loaded | |
vm=`VBoxManage list vms | zenity --list --title="Virtualbox machines" --column="Machine"` | |
if [ ! -z "$vm" ]; then | |
VBoxManage startvm $vm |
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
b <- function(path = "package/", ...){ | |
require(devtools) | |
require(roxygen2) | |
pkg <- as.package(path) # package pointer | |
## update documentation | |
message("Updating documentation...") | |
roxygenise(path, ...) |
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
// send HTTP POST request | |
function send_http($url, $params = null, $type = 'GET') | |
{ | |
$type = strtoupper($type); // request type | |
if (!preg_match('/^(GET|POST)$/', $type)) { | |
die("Unsupported method type: '$type'"); | |
} | |
/* generate POST string */ | |
$query_string = ''; |
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
// Quick & dirty watermark function | |
// inspired by https://github.com/marioestrada/jQuery-Watermark | |
(function ($){ | |
$.fn.watermark = function(){ | |
var $elems = $(this).filter('textarea, input[type="text"]'); | |
$elems.each(function(i, e){ | |
OlderNewer