0% found this document useful (0 votes)
4 views8 pages

Fundamentos de Programación en R

The document is a programming assignment by Daniel Tene Valencia that covers basic programming concepts, mathematical operations, and data analysis using R. It includes examples of mathematical operations, object programming, matrix assignments, and data visualization techniques with datasets like 'trees' and 'PlantGrowth'. The document also features graphical representations such as boxplots and pie charts for quantitative and qualitative data analysis.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

Fundamentos de Programación en R

The document is a programming assignment by Daniel Tene Valencia that covers basic programming concepts, mathematical operations, and data analysis using R. It includes examples of mathematical operations, object programming, matrix assignments, and data visualization techniques with datasets like 'trees' and 'PlantGrowth'. The document also features graphical representations such as boxplots and pie charts for quantitative and qualitative data analysis.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Deber

Daniel Tene Valencia

2024-01-12

Programacion basica
Operaciones matemáticas
4+2

## [1] 6

2/2

## [1] 1

suma <- 4+2


suma

## [1] 6

Programacion de objetos
Daniel <- 4-2
Daniel

## [1] 2

Agricola <- 2*3


a <- 1
b <- c(1,2)
b

## [1] 1 2

c <- c(1,3,5)
c

## [1] 1 3 5

d <- c("2","4","6","8","10")
d

## [1] "2" "4" "6" "8" "10"

asignatura <- c("estadistoica","topografia","caracterizacion","meteorolog


ia")
asignatura
## [1] "estadistoica" "topografia" "caracterizacion" "meteorologi
a"

Asignacion de matrices
matrix(1:10,nrow=2,ncol=5)

## [,1] [,2] [,3] [,4] [,5]


## [1,] 1 3 5 7 9
## [2,] 2 4 6 8 10

f <- matrix(1:10,nrow=2,ncol=5)
f

## [,1] [,2] [,3] [,4] [,5]


## [1,] 1 3 5 7 9
## [2,] 2 4 6 8 10

g <- matrix(1:10,2,5,byrow=T)
g

## [,1] [,2] [,3] [,4] [,5]


## [1,] 1 2 3 4 5
## [2,] 6 7 8 9 10

Ejemplos utilizando vases de datos


data(trees)
? trees

## starting httpd help server ... done

str(trees)

## '[Link]': 31 obs. of 3 variables:


## $ Girth : num 8.3 8.6 8.8 10.5 10.7 10.8 11 11 11.1 11.2 ...
## $ Height: num 70 65 63 72 81 83 66 75 80 75 ...
## $ Volume: num 10.3 10.3 10.2 16.4 18.8 19.7 15.6 18.2 22.6 19.9 ...

attach(trees)

Analisis y reprecentacion grafica de una variable cuantitativa


summary(Volume)

## Min. 1st Qu. Median Mean 3rd Qu. Max.


## 10.20 19.40 24.20 30.17 37.30 77.00

sd(Volume)

## [1] 16.43785

var(Volume)
## [1] 270.2028

boxplot(Volume)

boxplot(Volume,main="Volumen",sub="Elaborado por:Daniel Tene Valencia")


boxplot(Height)

Ejemplo con una nueva vase de datos


data(PlantsGrowth)

## Warning in data(PlantsGrowth): data set 'PlantsGrowth' not found

?PlantGrowth
str(PlantGrowth)

## '[Link]': 30 obs. of 2 variables:


## $ weight: num 4.17 5.58 5.18 6.11 4.5 4.61 5.17 4.53 5.33 5.14 ...
## $ group : Factor w/ 3 levels "ctrl","trt1",..: 1 1 1 1 1 1 1 1 1 1 ..
.

attach(PlantGrowth)

Analisis y reprecentacion grafica de una variable cualitativa


table(group)

## group
## ctrl trt1 trt2
## 10 10 10

barplot(table(group))

pie(table(group))
summary(weight)

## Min. 1st Qu. Median Mean 3rd Qu. Max.


## 3.590 4.550 5.155 5.073 5.530 6.310

boxplot(weight)
boxplot(weight,main="Peso",sub="Elaborado por: Daniel Tene Valencia")

pie(weight,main="Peso",sub="Elaborado por: Daniel Tene Valencia")

You might also like