正在加载图片...
6 CHAPTER 1.PRELIMINARIES A further package that will be discussed here,the ggplot?package,is not an R commander suggested package,and requires separate installation.Enter,at the command line: install("ggplot2",dependencies=TRUE) 1.2 The R Commander 1.3 The R Commander GUI The R commander gives a graphical user interface(GUI)to a wide range of abilities,in the base R system and in R packages.This includes graphical abilities,in the lattice and rgl packages as well as in base graphics. To start the R commander,start up R and enter:1 library(Rcmdr) This opens an R Commander script window,with the output window underneath.This window can be closed by clicking on the x in the top left corner.If thus closed,enter Commander()to reopen it again later in the session. The R Commander GUI-a guide to getting started Once the points that will now be noted are understood,use of the R Commander should for the most part be straightforward. From GUI to writing code:The R commander displays the code that it generates.Users can take this code,modify it,and re-run it.The code can be run either from the R Commander script window or from the R console window (if open). The active data set:The R commander has the notion of an active data set.Here are alternative ways to make a data set active.Start by clicking on the Data drop-down menu.Then Click on Active data set,and pick from among data sets,if any,in the workspace. Click on Import data,and follow instructions,to read in data from a file.The data set is read into the workspace,at the same time becoming the active data set. Click on New data set...,then entering data via a spreadsheet-like interface. Click on Data in packages,click on Read Data from Package,then identify one of the attached packages and choose a data set from among those that are included with the package. A further possibility is to load data from an R image(.RData)file;click on Load data set... Creating graphs:To draw graphs,click on the Graphs drop-down menu.Then Click on Scatterplot...to obtain a scatterplot.This uses the function scatterplot()from the car package,which is an option rich interface to functions that are in base graphics. .Click on X Y conditioning plot...for lattice scatterplots and panels of scatterplots. Click on 3D graph to obtain a 3D scatterplot,using the R Commander function scatter3d() that is an interface to functions in the rgl package. 1At startup,the R Commander checks whether all the suggested packages,needed to use all its features,are available. If some are missing,then upon starting up,the R commander offers to install them.For installing such packages,there must be a live internet connection.6 CHAPTER 1. PRELIMINARIES A further package that will be discussed here, the ggplot2 package, is not an R commander suggested package, and requires separate installation. Enter, at the command line: install ( " ggplot2 " , dependencies = TRUE ) 1.2 The R Commander 1.3 The R Commander GUI The R commander gives a graphical user interface (GUI) to a wide range of abilities, in the base R system and in R packages. This includes graphical abilities, in the lattice and rgl packages as well as in base graphics. To start the R commander, start up R and enter:1 library ( Rcmdr ) This opens an R Commander script window, with the output window underneath. This window can be closed by clicking on the × in the top left corner. If thus closed, enter Commander() to reopen it again later in the session. The R Commander GUI – a guide to getting started Once the points that will now be noted are understood, use of the R Commander should for the most part be straightforward. From GUI to writing code: The R commander displays the code that it generates. Users can take this code, modify it, and re-run it. The code can be run either from the R Commander script window or from the R console window (if open). The active data set: The R commander has the notion of an active data set. Here are alternative ways to make a data set active. Start by clicking on the Data drop-down menu. Then • Click on Active data set, and pick from among data sets, if any, in the workspace. • Click on Import data, and follow instructions, to read in data from a file. The data set is read into the workspace, at the same time becoming the active data set. • Click on New data set . . . , then entering data via a spreadsheet-like interface. • Click on Data in packages, click on Read Data from Package, then identify one of the attached packages and choose a data set from among those that are included with the package. • A further possibility is to load data from an R image (.RData) file; click on Load data set . . . Creating graphs: To draw graphs, click on the Graphs drop-down menu. Then • Click on Scatterplot . . . to obtain a scatterplot. This uses the function scatterplot() from the car package, which is an option rich interface to functions that are in base graphics. • Click on X Y conditioning plot . . . for lattice scatterplots and panels of scatterplots. • Click on 3D graph to obtain a 3D scatterplot, using the R Commander function scatter3d() that is an interface to functions in the rgl package. 1At startup, the R Commander checks whether all the suggested packages, needed to use all its features, are available. If some are missing, then upon starting up, the R commander offers to install them. For installing such packages, there must be a live internet connection
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有