User Tools

Site Tools


r:getting_started

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
r:getting_started [2016/09/07 16:20] – [Getting help] hkimscilr:getting_started [2021/03/02 09:48] (current) – [A trial] hkimscil
Line 22: Line 22:
 | Suse  | R-base  | | Suse  | R-base  |
 Use the system’s package manager to download and install the package. Normally, you will need the root password or sudo privileges; otherwise, ask a system administrator to perform the installation. Use the system’s package manager to download and install the package. Normally, you will need the root password or sudo privileges; otherwise, ask a system administrator to perform the installation.
 +====== Rstudio ======
 +[[https://www.rstudio.com/|Rstudio as a R tool]]
 +[[https://www.rstudio.com/products/rstudio/download/#download|download]] for windows OS.
  
 ====== Starting R ====== ====== Starting R ======
Line 33: Line 36:
 __Linux or Unix__  __Linux or Unix__ 
   * Start the R program from the shell prompt using the R command (uppercase R).    * Start the R program from the shell prompt using the R command (uppercase R). 
 +====== A trial ======
 +<code>install.packages("NRAIA")
 +library(NRAIA)
 +detach(package:NRAIA)
 +</code>
 +<code>trees
 +summary(trees)
 +boxplot(trees)
 +pair(trees)
 +</code>
 +<code>cars
 +plot(dist~speed, data=cars)
 +m.cars <- lm(dist ~ speed, data=cars)
 +m.cars
 +summary(m.cars)
 +</code>
 +
 +<code>chickwts
 +summary(chickwts)
 +boxplot(weight~feed, data=chickwts)
 +anova(lm(weight~feed, data=chickwts) ## or . . . 
 +m.chck <- aov(weight~feed, data = chickwts)
 +m.chck
 +summary(m.chck)
 +</code>
  
 +----
 +[[:t-test]]
 +[[:ANOVA]]
 +[[:Factorial ANOVA]]
 +[[:correlation]]
 +[[:regression]]
 +[[:Multiple regression]]
 +----
 ====== Entering commands ====== ====== Entering commands ======
 <code> <code>
Line 97: Line 133:
 //__Search Engine & Keywords__// //__Search Engine & Keywords__//
 Click here to access a simple search engine, which allows you to search the documentation by keyword or phrase. There is also a list of common keywords, organized by topic; click one to see the associated pages. Click here to access a simple search engine, which allows you to search the documentation by keyword or phrase. There is also a list of common keywords, organized by topic; click one to see the associated pages.
 +====== Getting help from functions ======
 +
 +Use help to display the documentation for the function:
 +<code> > help(functionname) </code>
 +Use args for a quick reminder of the function arguments:
 +<code> > args(functionname) </code>
 +Use example to see examples of using the function:
 +<code> > example(functionname) </code>
 +
 +<code> > help(mean) </code>
 +<code> > ?mean </code>
 +<code> > args(mean) </code>
 +<code> > example(mean) </code>
 +<code> > > example(mean)
 +
 +mean> x <- c(0:10, 50)
 +
 +mean> xm <- mean(x)
 +
 +mean> c(xm, mean(x, trim = 0.10))
 +[1] 8.75 5.50
 +</code>
 +
 +see [[https://3months.tistory.com/97|this document]] for **trim** option
 +
 +<code> mean> mean(USArrests, trim = 0.2)
 +Murder Assault UrbanPop Rape
 +7.42 167.60 66.20 20.16
 +</code>
 +
 +<code> mean> colMeans(USArrests)
 +Murder Assault UrbanPop Rape
 +7.42 167.60 66.20 20.16
 +</code>
 +see [[https://rfriend.tistory.com/40|this document]] for **colMeans** function.
 +
 +====== Searching via Keywords ======
 +<code> > help.search("pattern") </code>
 +  * A typical pattern is a function name or keyword. 
 +  * Notice that it must be enclosed in quotation marks.
 +
 +<code> > ??pattern </code>
 +
 +<code> > help.search("social network") </code>
 +
 +====== Getting help on a package ======
 +<code> > help(package="packagename") </code>
 +
 +<code> > help(package="tseries") </code>
 +
 +<code> > install.package("tseries")
 +Error: could not find function "install.package"
 +</code>
 +
 +<code> > install.packages("tseries")
 +Installing package into ‘D:/Users/Hyo/Documents/R/win-library/3.2’
 +(as ‘lib’ is unspecified)
 +--- Please select a CRAN mirror for use in this session ---
 +trying URL 'https://cran.ism.ac.jp/bin/windows/contrib/3.2/tseries_0.10-35.zip'
 +Content type 'application/zip' length 321067 bytes (313 KB)
 +downloaded 313 KB
 +
 +package ‘tseries’ successfully unpacked and MD5 sums checked
 +
 +The downloaded binary packages are in
 +        C:\Users\Hyo\AppData\Local\Temp\RtmpmQCQRK\downloaded_packages
 +> help(package="tseries")
 +
 +</code>
 +
 +{{help.package.jpg}}
 +
 +====== Searching the Web for help ======
 +<code> > RSiteSearch("ANOVA") </code>
 +
 +====== Finding Relevant Functions and Packages ======
 +  * Visit the list of task views at http://cran.r-project.org/web/views/. Find and read the task view for your area, which will give you links to and descriptions of relevant packages. Or visit http://rseek.org, search by keyword, click on the Task Views tab, and select an applicable task view.
 +  * Visit [[http://crantastic.org/|crantastic]] and search for packages by keyword.
 +  * To find relevant functions, visit http://rseek.org, search by name or keyword, and click on the Functions tab.
 +
 +
 +
r/getting_started.1473234606.txt.gz · Last modified: 2016/09/07 16:20 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki