0 views

Uploaded by Anna

- Date Time
- SM1 Ch6 Hand Span Measurements
- 55815415-51988059-38172708-Gsm-Bss-Kpi-Analysis
- Statistics II
- javascript es6
- Consumer
- R Help 2 the R Language
- De Thi Thuc Hanh
- pql
- f4 c7 Statistics Set 2
- Statistics Measures of Central Tendency Unit Plan
- Statistic
- statistical measures
- Aptitude Test 3
- Mach3 V3.x Programmer Reference Draft v0.11
- Stats_ Probability Distributions1
- 10740499_739314762823128_2045135851_n - Copy
- Pile Foundation
- Chapter5 Stats
- index.pdf

You are on page 1of 2

Summary

Many people find adjusting to R quite tricky at first because it’s very different to using a point-and-

click programme like Excel or SPSS. This guide provides an introduction to how R works, with help on

some of the jargon.

Objects

Typing something into R will give you an answer in the command window, but if you want to use

something several times you need to “save” it into R’s memory by assigning it as an object using the

‘gets’ arrow (<-) You can then type the name of that object (here, x) to call back the thing you saved:

Objects needn’t be single values: they can be a series of values (vectors), or a whole database of

different variables (dataframes). R has lots of built-in dataframes, so we’ll use one as an example:

type PlantGrowth into the R command window to see the PlantGrowth dataframe. We can see that

PlantGrowth contains two variables (vectors), weight and group. Using attach(PlantGrowth) allows

us to call these variables as objects:

Functions

We can now do things to all the numbers in the weight vector simply by typing in its name. For

example, simple calculations can be done using arithmetic operators like +, -, * (multiplication), or /

(division):

In this example, we’ve added 1 to every number. However, to do more complicated things, you can

use one of R’s built-in functions. To do use a function, we type the name of each function followed

by the information we want the function to use (called arguments) in brackets. For example, to see

how many different values (or elements), there are in the weight vector, we can use the length

function:

Here, mean, sum and length are all functions, while weight is the argument. Several arguments can

be included in many functions; for example, typing mean(weight, na.rm=T) will remove any missing

weight values before taking the mean (see Help Sheets 3 and 4).

Other handy functions for calculations include: summary, signif, sd, var, sqrt, log, asin. To find out

what these do, trying using the help function (Help Sheet 3).

Classes

There are several different types (or classes) of vectors. R treats different classes of vectors in

different ways, so it’s important to make sure the vectors you’re working with are classified

correctly. The main ones are:

• integer - whole numbers (1,2,3,4…) only (e.g. a count of individuals)

• logical – values must be either TRUE or FALSE (e.g. the presence or absence of a species)

• factor – categorical variables (e.g. group from the PlantGrowth dataframe).

To find out what type of vector you have, use the class function:

It’s often worth doing this if you get an error message, to check that R’s got things right. However,

beware that you might not always get an error message, so it’s worth making sure before you start

working with any variable. For example, if we’d classified the groups in the PlantGrowth dataframe

as groups 1, 2, and 3, R would assume that group was an integer variable (continuous series of whole

numbers) rather than a factor (categorical variable), as we intended.

New variables with the correct class assignments can be assigned using the gets arrow (Help sheet 1)

The different categories, or levels of a factor can be assessed using the levels function:

The number of appearances of each category in a factor can be totalled using the table function:

- Date TimeUploaded byvladomanija
- SM1 Ch6 Hand Span MeasurementsUploaded byKarla Hoffman
- 55815415-51988059-38172708-Gsm-Bss-Kpi-AnalysisUploaded byBasanta Kumar Swain
- Statistics IIUploaded byKenneth Tham
- javascript es6Uploaded byella
- ConsumerUploaded bypavan
- R Help 2 the R LanguageUploaded byAnna
- De Thi Thuc HanhUploaded bynguyentuan822
- pqlUploaded byTina Berry
- f4 c7 Statistics Set 2Uploaded byMK Joey Tham
- Statistics Measures of Central Tendency Unit PlanUploaded bycaleb castillo
- StatisticUploaded bywaleed
- statistical measuresUploaded byapi-362588611
- Aptitude Test 3Uploaded byshashiraje5922
- Mach3 V3.x Programmer Reference Draft v0.11Uploaded byAlexandre Oliveira
- Stats_ Probability Distributions1Uploaded bymurtaza5500
- 10740499_739314762823128_2045135851_n - CopyUploaded byAitazaz Ahsan
- Pile FoundationUploaded byglbforu
- Chapter5 StatsUploaded byPoonam Naidu
- index.pdfUploaded byAnonymous 9ZwODr
- Math DemoUploaded byJohn Paul Ore
- Sampling Distribution of Sample MeansUploaded byChristian Gelilang
- Example of Sieve Analysis Data CalculationsUploaded byPrasanna Kumar S Mural
- Study on the Performance of Clarias Gariepinus Fed With Local Integrated Fish FeedUploaded byIJARP Publications
- Mean Median MathsUploaded byanandsonachalam
- Custom Components Guide 210 Enu 0Uploaded byPhanHatham
- ConfidentialUploaded byneo_dax
- HowToDevelopandUseDynamicVariables.docUploaded byVasuDeva
- FunctionsUploaded byవిశ్వేష్ నాగమల్ల
- MKTUploaded bypamagand

- Doc1Uploaded byAnna
- meal planner.docxUploaded byAnna
- R Help 2 the R LanguageUploaded byAnna
- R Help 3 Getting HelpUploaded byAnna
- Breif SISUploaded byAnna
- Van Budget 1Uploaded byAnna
- Journal SummarysUploaded byAnna
- WolseyUploaded byVini Tiastuti
- 2. Bridging the Gaps 2018. KmUploaded byAnna
- Atomic Emission SpectraUploaded byAnna
- Lecture 11 Coop and Mutualism Post Lecture Slides 2017Uploaded byAnna
- Challenging the ByProduct Theory of ReligionUploaded byAnna
- R Help 1 Data ImportUploaded byAnna
- R Help 6 Correlation and RegressionUploaded byAnna
- Cells and OrganellesUploaded byAnna
- Hello WorldUploaded byAnna
- Controlled Assessment Plan ProformaUploaded byAnna
- prob + sol in trop rainfUploaded byAnna
- Cress Seeds Write UpUploaded byAnna
- Balancing EquationsUploaded byAnna
- Yo OoooooooUploaded byAnna
- Una Dieta Sana - A Healthy Diet TextUploaded byAnna
- Excersize ParaUploaded byAnna
- Cress Seeds Write UpUploaded byAnna
- Blank Controlled Assesment PlanUploaded byAnna
- 97 Rural and Urb PopsUploaded byAnna
- School SubjectsUploaded byAnna

- LicenseUploaded bya
- h002921eUploaded byhpg1234
- sqlparte2Uploaded byGuadalupe Santiago
- PeopleSoft Human Capital Management 9.2 Through Update Image 23 Installation 072017Uploaded byChakravarthiVeda
- Usersguide Qcc Cli Sn0054667-00lUploaded byYamini Umapathy
- Manual ETANK2000Uploaded byEver Briceño
- How to Install p6_ How to Install Primavera p6 Crack Version_ - Civil EngineUploaded byAnonymous 1tmhvi
- Computer Project FileUploaded byRam Kumar
- 1-Introduction (PIFRA FMM)Uploaded bySalah Ud Din
- lesson plan rockpaperscissorsUploaded byapi-169562716
- Finepix Jx400jx300series Manual 01Uploaded byMoofdoggy
- 1608_iiot_ebook_v2Uploaded bymaxkwo
- learnmonkey.pdfUploaded byKhoirotul Ainiyah
- Circuit Cam40 TutorialUploaded byDede Sadi
- CT10 Barcode Scanner User Manual v4.0Uploaded byWagner Rodrigues
- Syllabus Me-8 Viii Sem All SubjectUploaded byDeepak prasad
- A Method to Determine End-Points ofStraight Lines Detected Using the Hough TransformUploaded byAnonymous 7VPPkWS8O
- MisUploaded bySylvia Nabwire
- C++ by Example.pdfUploaded byAnuradha Raheja
- BMC Education - Cloud Computing Trainingv2Uploaded byBMCEducation
- ch3_unit2Uploaded byRajesh Vungarala
- java programing TestUploaded bysyedazharuddin
- 35 Digital Tools That Work With Bloom's TaxonomyUploaded byNorhisham Mohamad Nordin
- 8051 Instruction SetUploaded byAmbar Mukherjee
- CREATING AWARENESS OF ICT TO END USERSUploaded byyann_1021
- Concepts_WinDev.pdfUploaded byJason Oscar Roberts
- Man Dds SoftUploaded byAl Zanoaga
- ABAP Debugging Techniques.pptUploaded byKaruparthi Kuber
- OracleUploaded bySunil Patil
- Introduction to the Security Engineering Risk Analysis (SERA) Framework.pdfUploaded byPinnacle Systems Group