Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


Getting Started with R: A Comprehensive Guide for Beginners, Apuntes de Ingeniería Biomédica

An introduction to r, an open-source program for statistics and graphics. It covers r's basics, installation, and getting started with the console and help system. The guide also explains how to create and manipulate objects such as vectors, matrices, dataframes, and lists. Additionally, it introduces functions and attributes. The document concludes with an exercise to practice these concepts.

Tipo: Apuntes

2016/2017

Subido el 05/11/2017

elena2318
elena2318 🇪🇸

4

(1)

2 documentos

1 / 13

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
INTRODUCTION TO R: BASICS
Luis Eduardo Mujica
Magda Ruiz
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Vista previa parcial del texto

¡Descarga Getting Started with R: A Comprehensive Guide for Beginners y más Apuntes en PDF de Ingeniería Biomédica solo en Docsity!

INTRODUCTION TO R: BASICS

Luis Eduardo Mujica Magda Ruiz

WHAT IS R?

R is an incredibly powerful open source program for statistics and graphics. It can run on pretty much any computer and has a very active and friendly support community online. Graphics created by R are extremely extensible and are used in high level publications. RStudio is an integrated development environment (IDE) for R. It’s basically a nice front-end for R, giving you a console, a scripting window, a graphics window, and an R workspace, among other options. R Commander is a basic graphical user interface (GUI) for R. It provides a series of menus that allow you to run lots of statistic tests and create graphics without typing a line of code.

TUTORIALS

TUTORIALS

¢ From R website under “Documentation”

— “Manual” is the listing of official R documentation — “Contributed” documentation are tutorials and manuals created by R users — R FAQ — Mailing Lists (listserv)

¢ Texbooks

— Victor A. Bloomfield_. Using R for Numerical Analysis in Science and Engineering_. Chapman & Hall/CRC, 2014. ISBN 978- — Torsten Hothorn and Brian S. Everitt. A Handbook of Statistical Analyses Using R. Chapman & Hall/CRC Press, Boca Raton, Florida, USA, 3rd edition, 2014. ISBN 978-1-4822-0458-2. — Sarah Stowell. Using R for Statistics. Apress, 2014. ISBN 978-

GETTING STARTED (CONSOLE)

¢ Start the R system, the main window (RGui) with a sub

window (R Console) will appear

In the `Console' window the cursor

is waiting for you to type in some

R commands.

GETTING STARTED (HELP)

¢ Once R is installed, there is a comprehensive built-in

help system. At the program's command prompt you

can use any of the following:

help.start() # general help help(foo) # help about function foo ?foo # same thing apropos("foo") # list all function containing string foo example(foo) # show an example of function foo help.search("foo") # help topics matching foo RSiteSearch("foo") # search for foo in help manuals and archived mailing lists

GETTING STARTED (OBJECTS)

¢ Types of objects:

— Vectors

vec1 <- c(1,2,0,1)!

— Matrices

mat1 <- matrix(1:8,nrow=2)!

— Dataframes

df1 <- data.frame(x1=1:10,x2=letters[1:10])!

— Lists

l1 <- list(a=1:10,b=letters[1:3],d=matrix(1:10,ncol=2))!

— Functions

fun1 <- function(x)x^3!

¢ Attributes:

— mode: numeric, character, complex, logical

— length: number of elements in object

GETTING STARTED (WORKSPACE)

¢ During an R session, all objects are stored in a

temporary, working memory

— List objects

ls()!

— Remove objects

rm()!

— Print the current working directory

wd()!

— During a session you can use the arrow keys to review the

command history

EXERCISE

In 2015 the charges by month of your mobile phone were:

a) How much do you spend in the year?

b) Which month do you spend less money? How much?

c) Which month do you spend more money? How much?

d) Which months do you spend more than the average?

Write a script defining a dataframe with months and

charges. The script should automatically answer the

questions, even if you change any value.