#這個命令,能夠把R的整數表示能力設爲10位。 options(digits=10)
options(CRAN="http://cran.r-project.org") install.packages("擴展包名")
用R寫代碼時,打字水平不高,有時候不知道亂按了一些鍵(如今我還不知道哪一個鍵),光標就變成了加粗的豎直線,又改不回去。這種狀況下咱們能夠用options函數進行光標設置,例如:html
##能夠隨意設置你的光標類型(prompt參數設置)。 ##光標開始默認爲 > options(prompt="|") ##光標爲 | options(prompt=">") ##光標爲 > options(prompt="|") ##光標爲 | options(prompt="+") ##光標爲 + options(prompt="-") ##光標爲 - options(prompt="8") ##光標爲 8 options(prompt=">") ##光標設置爲開始默認值 >
#這個命令,能夠忽視任何警告 options(warn=-1) #這個命令,不放過任何警告 options(warn=1) #示例展現 ow <- options("warn") for(w in -1:1) { options(warn = w); cat("\n warn =", w, "\n") for(i in 1:4) { cat(i,"..\n"); m <- matrix(1:7, 3,4) } } warnings() options(ow) # reset tail(warnings(), 2) #說明: warn: sets the handling of warning messages. If warn is negative all warnings are ignored. If warn is zero (the default) warnings are stored until the top–level function returns. If 10 or fewer warnings were signalled they will be printed otherwise a message saying how many were signalled. An object called last.warning is created and can be printed through the function warnings. If warn is one, warnings are printed as they occur. If warn is two or larger all warnings are turned into errors. ------- 警告: 設置警告消息的處理。若是警告是負面的,全部的警告都會被忽略。若是警告是零(默認)警告被存儲到頂部,級別的函數返回。若是10個或更少的警告信號,他們將被打印出來,不然一個消息說有多少人發出信號。一個對象稱爲last.warning能夠經過打印功能warnings。若是警告是一個,警告是印刷的,由於它們發生。若是警告是2或更大的全部警告被變成錯誤。 ##還能夠width來調整向量,矩陣的輸出寬度,還包括是否用warnning來顯示錯誤信息(show.error.messages)以及錯誤信息的長度(warning.length)。 options(show.error.locations = TRUE) options("show.error.messages")
add.smooth TRUE
check.bounds FALSE continue "+ " digits 7 echo TRUE encoding "native.enc" error NULL expressions 5000 keep.source interactive() keep.source.pkgs FALSE max.print 99999 OutDec "." prompt "> " scipen 0 show.error.messages TRUE timeout 60 verbose FALSE warn 0 warning.length 1000 width 80 #裝載不一樣的擴展包還會增長一些新的屬性信息