博文

目前显示的是 九月, 2016的博文

vim 自动补全括号

sudo vim /usr/share/vim/vimrc ### sudo find / -name '*vimrc' function! AutoPair(open, close)         let line = getline('.')         if col('.') > strlen(line) || line[col('.') - 1] == ' '                 return a:open.a:close."\<ESC>i"         else                 return a:open         endif endf function! ClosePair(char)         if getline('.')[col('.') - 1] == a:char                 return "\<Right>"         else                 return a:char         endif endf function! SamePair(char)         let line = getline('.')         if col('.') > strlen(line) || line[col('.') - 1] == ' '                 return a:char.a:char."\<ESC>i"         elseif line[col('.') - 1] == a:char                 return "\<Right>"         else                 return a:char         endif endf function! RemovePairs()     let l:line = getline(".&

R等比例抽样

library(caret) #等比例抽样,按照物种分类的变量抽取10%的样本 splitindex <- createDataPartition(iris$Species,times = 1,p = 0.1,list = FALSE) sample <- iris[splitindex,] #亚变量处理 cor(iris[,1:4]) dmy <-dummyVars(~Species,data=iris) result <- data.frame(predict(dmy,newdata = iris)) #Rattle library(rattle) rattle()

ubuntu 安装 flash 插件

sudo apt install flashplugin-installer

forcats包简介

图片
forcats forcats 安装 # install.packages("devtools") devtools::install_github("hadley/forcats") ## Skipping install of 'forcats' from a github remote, the SHA1 (004279de) has not changed since last install. ## Use `force = TRUE` to force installation 使用 library(dplyr) ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union library(ggplot2) library(forcats) head(gss_cat) ## # A tibble: 6 × 9 ## year marital age race rincome partyid ## <int> <fctr> <int> <fctr> <fctr> <fctr> ## 1 2000 Never married 26 White $8000 to 9999 Ind,near rep ## 2 2000 Divorced 48 White $8000 to 9999 Not str repub