でーたさいえんすって何それ食えるの?

JuliaとかRとかPythonとかと戯れていたい

Jupyter on Mac OS X El Capitan

El CapitanでJupyterの環境整備してたら途中で詰まったので、その時の備忘録

c.f.

http://jupyter.readthedocs.org/en/latest/install.html

前置き

上のリンクにある通りコマンドを打ってみる

sudo pip install jupyter

と、インストールがコケる

どうやらEl Capitanあたりから導入されたSystem Integrity Protection (SIP) が原因でpipできない。 (homebrewでpythonを入れてると、このpip問題は起きないらしい)

macportで色々入れてきたので、今更homebrewを入れるのもなぁ…という事でSIPを無効化する

手順

  1. macを再起動させ、起動音が鳴った辺りでCommand + R
    これで起動すると、リカバリ等が出来るモードで立ち上がるハズ
  2. 上のメニューのUtility -> terminalでターミナルを立ち上げて以下のコマンドを打つ
csrutil disable

後は普通に再起動
3. 起動後、SIPが無効になってるか確認するため、ターミナルで

$ csrutil status
System Integrity Protection status: disabled.
  1. あとは、インストール手順通りに pip を打てばOK

R import multiple packages at once

モチベーション

Rでlibrary()を打つ行数減らしたいよねー

e.g. ふつーなら

library(magrittr)
library(dplyr)
library(igraph)
library(data.frame)

一気にやりたいんで

libs <- c("magrittr", "dplyr", "igraph", "data.frame")
apply(libs, require, character.only = T)

User Input has better way

We know better and simple way.

list_options <- c("add an item",
                  "Delete an item",
                  "Print the list",
                  "Quit")

select.list(list_options)

source article

www.r-bloggers.com