100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
2. An introduction to using R $2.70
Add to cart

Presentation

2. An introduction to using R

 113 views  0 purchase
  • Course
  • Institution

A link to the sample data is provided in the presentation. This section covers indexing and sub-setting, the use of square brackets, calculating summary statistics; functions such as mean(), by the end of this you will be comfortable with creating objects. The apply() function is covered as well a...

[Show more]
Last document update: 6 year ago

Preview 7 out of 113  pages

  • July 6, 2018
  • July 23, 2018
  • 113
  • 2017/2018
  • Presentation
  • Unknown
avatar-seller
An introduction to R – part 2
Use the same R script as session 1

,Indexing and Sub-Setting
“finding and grabbing part of your data”

Link to data is found at end of presentation

,Indexing and sub-setting
• Recall that R has stored your data in a data frame; a good way to th
of this is the equivalent of a spreadsheet
• If you think of a data frame as a spreadsheet then you’ll be able to grasp t
concept of the frame dimensions
• There are two: rows and columns
• Often one needs to analyse only a subset of data such as certain ro
or columns (particular variables)
• Indexing: R data frame has assigns numerical values to your rows a
columns. These are implicit, i.e. R is not going to alter your data se
but these implicit numbers allow you to generate a subset of your
data. This is known as indexing

,How does one sub-set data?
• By use of [] and ,
• The square brackets replace the round brackets
• Therefore if I want to generate a subset of data from my session 1
data; I would use the following
Session1Data[]
• Within the brackets, you tell R what to do by using numbers and a
comma

,
,How does one sub-set data?
• By use of [] and ,
• The square brackets replace the round brackets
• Therefore if I want to generate a subset of data from my session 1 data;
would use the following
Session1Data[]
• Within the brackets, you tell R what to do by using numbers and a comm
• I have chosen to use the same R script from before and indicate as such
with the annotation
# Session 2
• I selected and ran this line of code

, How to use [] and ,
• Have your data file open in excel while you look at the next few step
• Type in the following and run it
Session1Data[1,]

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller dominique13. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.70. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

51036 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 15 years now

Start selling
$2.70
  • (0)
Add to cart
Added