最新版はこちら: https://speakerdeck.com/yutannihilation/ggplot2zai-ru-men
最新版はこちら: https://speakerdeck.com/yutannihilation/ggplot2zai-ru-men
[This article was first published on ipub » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. In this post, we write a shiny app that lets you display and modify data that is stored in a database table. Shiny and Databases Everybody loves Shiny, and righ
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Not your computer? Use a private browsing window to sign in. Learn more about using Guest mode
となる。 まずはパッケージのロードと、よく使われるサンプルデータ(baseball)を表示 library(plyr) head(baseball) ## id year stint team lg g ab r h X2b X3b hr rbi sb cs bb so ## 4 ansonca01 1871 1 RC1 25 120 29 39 11 3 0 16 6 2 2 1 ## 44 forceda01 1871 1 WS3 32 162 45 45 9 4 0 29 8 0 4 0 ## 68 mathebo01 1871 1 FW1 19 89 15 24 3 1 0 10 2 1 2 0 ## 99 startjo01 1871 1 NY2 33 161 35 58 5 1 1 34 4 2 3 0 ## 102 suttoez01 1871 1 CL1 29 128 35
S4/R5クラスのデバッグ Rにビルトインされたオブジェクト指向的なフレームワークを提供する仕組みとして、S3以外に、S4とR5がある。大規模なパッケージを作るときとか、mutableな機能を実装するときにはとても役立つ。 あとR5はR5 reference classというように、参照渡しのセマンティックで実装されてるので、関数型言語らしさはなくなっちゃうんだけど、馬鹿でかいデータとかある時にはコピーが発生しないので、効率がよくなるはず。 ここらへんを使ってる人は、特に説明もいらないと思うので、デバッグのやり方は以下の実例で。ポイントだけ箇条書きします。 S4の場合、traceにsignatureを渡す。 S4の場合、特定のインスタンスのメソッドだけデバッグする、というのは難しい(相当回りくどいことしないと無理だと思う)。 R5の場合、生成されたインスタンスのメソッドに対して普通の関数の
R2.12から実装されたR5クラスの覚え書きです。日本語の情報はまだないみたいなので一番乗りを狙って。ちなみに継承関係は、面倒なので完全に無視してます。ごめんなさい。その他、網羅性は期待しないでください。 R5クラスの特徴 参照渡し オブジェクトを編集できる S4より緩くて使いやすい 他にもあると思いますが、触ってみた感想ということで。 とりあえずクラス定義 tc <- setRefClass(Class="testClass", fields = list(f1="numeric", f2="numeric"), methods = list( foo = function() { "f1とf2を足し合わせるメソッド" f1 + f2 })) R5クラスはsetRefClass()で定義します。主に使うオプションは、Classとfieldsとmethodsです。Classでクラス名を定義
Rtips. Revival 2014! Paul E. Johnson <pauljohn @ ku.edu> The original Rtips started in 1999. It became difficult to update because of limitations in the software with which it was created. Now I know more about R, and have decided to wade in again. In January, 2012, I took the FaqManager HTML output and converted it to LaTeX with the excellent open source program pandoc, and from there I’ve been e
グラフに文字を記入したいときはtext関数とmtext関数が便利。 text関数 引数x, yで座標を指定できるので、自由度がかなり高い。 また、引数posで座標(x,y)に対して文字を書く位置を指定する。pos=1なら下辺、2なら左、3なら上、4なら右。 記入する文字は引数labelsで指定する。 > dat <- runif(100,min=10,max=20) > x <- hist(dat,plot=FALSE) > str(x) # $midsが棒グラフの中点、$countsが高さになる List of 7 $ breaks : num [1:11] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ... $ counts : int [1:10] 8 6 9 19 11 8 13 4 10 12 $ intensities: num [1:10] 0
Chicago R Meetup slides By romain francois on Thursday, October 21 2010, 15:35 - Permalink Second stop of my world tour was chicago yesterday night, where I presented a quick light review of various ways to represent objects in R: lexical scoping, S3, S4, the new reference classes and also with C++ using Rcpp modules or RProtoBuf My slides are on my slideshare account: Comments 1. On Thursday, Oct
昨日の続き では、正方行列を作らずに、非正方行列のままsvd()をかけるとどうなるかもやってみます。 同じ構造を表す固有値と固有ベクトルが取れました。 #構造化集団をシミュレート Nm<-1000 #マーカー数 Npop<-4 #亜集団数 Ns<-c(100,150,200,250) #集団別人数 M<-NULL #全ジェノタイプデータを納める行列 #亜集団別にアレル頻度を振ってシミュレーション for(j in 1:Npop){ tmpM<-matrix(rep(0,Nm*Ns[j]),nrow=Nm) for(i in 1:Nm){ af<-runif(1)*0.8+0.1 f<-rnorm(1,sd=0.01) if(abs(f)>1) f=0 df<-c(af^2,2*af*(1-af),(1-af)^2) df[1]<-df[1]+f/2*df[2] df[3]<-df[3]+f
A post on FlowingData blog demonstrated how to quickly make a heatmap below using R base graphics. This post shows how to achieve a very similar result using ggplot2. Data Import FlowingData used last season’s NBA basketball statistics provided by databasebasketball.com, and the csv-file with the data can be downloaded directly from its website. > nba <- read.csv("http://datasets.flowingdata.com/p
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く