Skip to content

Instantly share code, notes, and snippets.

@swuecho
swuecho / gist:1604771
Created January 13, 2012 05:04
cov2cor
cov2cor <- function(x) {
for (i in 1:dim(x)[1]){
for (j in 1:dim(x)[2]){
x[i,j]<-x[i,j]/sqrt(x[i,i]/sqrt[j,j]
}
}
}
@swuecho
swuecho / mean cov cor
Created January 14, 2012 05:38
mean cov cor
mulsum <- function(x) {
print(mean(x))
print(cov(x))
print(cor(x))
}
@swuecho
swuecho / gist:1861060
Created February 18, 2012 21:27
sharefold
mkdir /mmt/share
sudo mount -t vboxsf winshare/mnt/share
@swuecho
swuecho / gist:1890862
Created February 23, 2012 05:58
emacs FAQ
发信人: debian (6e9552c9bd8e61c8f277c21220160234), 信区: Emacs
标 题: FAQ(2006/11/24)
发信站: BBS 水木清华站 (Tue Nov 18 19:53:18 2003), 转信
Welcome to Emacs Heaven ! Happy Hacking ! -*- outline -*-
Emacs FAQ
* General
@swuecho
swuecho / gist:1893474
Created February 23, 2012 16:12
SAS IML
*****************************************************************************************/
SAS/IML software gives you access to a powerful and flexible programming language
*(Interactive Matrix Language) in a dynamic, interactive environment.
*
*The fundamental object of the language is a data matrix.
*You can use SAS/IML software interactively (at the statement level) to see results immediately,
*or you can store statements in a module and execute them later.
*The programming is dynamic because necessary activities such as memory allocation and
*dimensioning of matrices are performed automatically.
@swuecho
swuecho / gist:1912801
Created February 26, 2012 03:39
local
colors = [['red', 'green', 'green', 'red' , 'red'],
['red', 'red', 'green', 'red', 'red'],
['red', 'red', 'green', 'green', 'red'],
['red', 'red', 'red', 'red', 'red']]
measurements = ['green', 'green', 'green' ,'green', 'green']
motions = [[0,0],[0,1],[1,0],[1,0],[0,1]]
@swuecho
swuecho / meta.r
Created March 6, 2012 17:11
Meta analysis
###########data import###################
d<-read.csv('meta4digital.csv')
####################### fixed effect size#####################
df<-length(d$dIChR)-1
# 1/var of each study
W<-1/d$varIChR
# g of each study
Y<-d$dIChR
# sum var
M<-sum(W*Y)/sum(W)
@swuecho
swuecho / gist:2356792
Created April 11, 2012 04:08
quicksort-fail when pivot !=0
package main
import(
"os"
"io"
"bufio"
"fmt"
"strconv"
)
;; echowuhao's solution to Intro to Vectors
;; https://4clojure.com/problem/6
:a :b :c
@swuecho
swuecho / xsl2csv
Created June 8, 2012 03:49
convert all the xsl files to csv files in one directory
;;;convert all the xsl files to csv files in one directory
;get all the file names in one directory
(def directory (clojure.java.io/file "C:/Users/echo/Dropbox/7000/data-sets"))
(def files (file-seq directory))
(def filestr (map str files))
;find all the xls files in the directory
(def xlsfiles (filter #(re-find #".xls" %) filestr))
;clojure.string/replace
(defn xsl2csv [x] (save (read-xls x) (clojure.string/replace x #"xls" "csv")))
;convert all the xls file to csv files