Re: [問題]R 2.4.0
※ 引述《wwfc》之銘言:
> 最近安裝了R 2.4.0,卻發現它的help變成html形式,
這只是因為 2.4.0 的安裝程序中提供了個選項設定的程序,
而其內設的 help 是採用了 html 的格式.
有人誤以為是 R 有了新東西, 其實不是.
在 R 裡一共有 3 種格式來呈現 on-line help:
window, html, 與 chtml (complied html).
事實上還有第四種格式: LaTeX 的,
只是這種格式是為了提供 on-line 而作.
如果印象沒錯的話, R 在一開始就有這些!
進入放 R 的目錄 (資料夾) 下的 library 裡,
點選任一個 package, 就可看到
help (window 版), html, chtml, 與 latex
四個子目錄, 就是存放這些版本的地方.
> 打 help("topic"),會跳出該topic的help網頁,
> 不是之前版本的模式,雖然說內容一樣,但是總用不習慣,
> 想請問一下要怎麼設定,才能讓它回到之前的形式?
On-line help 的格式設定是由 R 目錄下, etc 子目錄中的
Rprofile.site
(純文字檔案, 可用任一編輯軟體開啟, 但在回存時仍應是純文字格式)
中來作設定.
例如我的 Rprofile.site 的內容是
---
1 # Things you might want to change
2
3 # options(papersize="a4")
4 # options(editor="notepad")
5 # options(pager="internal")
6
7 # to prefer Compiled HTML help
8 # options(chmhelp=TRUE)
9
10 # to prefer HTML help
11 # options(htmlhelp=TRUE)
12
13 options(digits=4, show.signif.stars=FALSE)
---
(開頭的數字序號 [行號] 是我在此加上去以便於說明之用)
因為行 8 與行 11 前都有個 # (comment, 註記符號),
使得 help 的格式是 window. (排除法的運用)
除非是使用 XEmacs + ESS 來使用 R,
我個人建議將行 8 開頭的 # 刪除,
使用 chtml (complied html) 的版本.
以此類推, 若想要使用以電腦中內設的瀏覽器來開啟 on-line help,
那麼就是將行 11 開頭的 # 刪除.
行 13 是我個人的偏好設定
(附在此順便說明這 Rprofile.site 可如何利用)
這是以 options() 來更動內設的 options settings
(上述 on-line help 版本的設定也是由此來更動)
digits = 4 是設定在呈現數值資料時, 原則上是以四位顯著位數來呈現,
原先內設是 digits = 7.
show.signif.stars=FALSE 是在列印摘要整理的參數估計表
(summary tables of coefficients) 時, 不列出星星 (stars) 註記,
這選項的預設是 TRUE (會列印)
例如:
> summary(lm(Volume ~ ., data=trees))
Call:
lm(formula = Volume ~ ., data = trees)
Residuals:
Min 1Q Median 3Q Max
-6.406 -2.649 -0.288 2.200 8.485
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -57.988 8.638 -6.71 2.7e-07
Girth 4.708 0.264 17.82 < 2e-16
Height 0.339 0.130 2.61 0.014
Residual standard error: 3.88 on 28 degrees of freedom
Multiple R-Squared: 0.948, Adjusted R-squared: 0.944
F-statistic: 255 on 2 and 28 DF, p-value: <2e-16
還原回原先內設值: TRUE
> options(show.signif.stars=TRUE)
> summary(lm(Volume ~ ., data=trees))
Call:
lm(formula = Volume ~ ., data = trees)
Residuals:
Min 1Q Median 3Q Max
-6.406 -2.649 -0.288 2.200 8.485
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -57.988 8.638 -6.71 2.7e-07 ***
Girth 4.708 0.264 17.82 < 2e-16 ***
Height 0.339 0.130 2.61 0.014 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.88 on 28 degrees of freedom
Multiple R-Squared: 0.948, Adjusted R-squared: 0.944
F-statistic: 255 on 2 and 28 DF, p-value: <2e-16
-----
希望這'借題發揮'沒有'弄巧成拙'才好!
--
cjlu 在 06/11/09 10:14:22 從 140.116.152.108 修改這篇文章
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):