Sie sind auf Seite 1von 13

R version 3.2.

3 (2015-12-10) -- "Wooden Christmas-Tree"


Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.


Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or


'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> datos1<data.frame(Genero=c("M","F","M","F","M","F"),talla(1.83,1.76,1.8
2,1.60,1.90,1.66),peso=c(67,58,66,48,75,55),row.names=c("Jose","Maria","A
ntonio","Marta","Willian","Elsa"))
Error: object 'datos1' not found
> datos1<-data.frame(Genero=c("M","F","M","F","M","F"),talla(1.83,1.76,1.
82,1.60,1.90,1.66),peso=c(67,58,66,48,75,55),row.names=c("Jose","Maria","
Antonio","Marta","Willian","Elsa"))
Error in data.frame(Genero = c("M", "F", "M", "F", "M", "F"), talla(1.83,
:
could not find function "talla"
> datos1<-data.frame(Genero=c("M","F","M","F","M","F"),talla c(1.83,1.76,
1.82,1.60,1.90,1.66),peso=c(67,58,66,48,75,55),row.names=c("Jose","Maria"
,"Antonio","Marta","Willian","Elsa"))
Error: unexpected symbol in "datos1<-data.frame(Genero=c("M","F","M","F",
"M","F"),talla c"
> datos1<-data.frame(Genero=c("M","F","M","F","M","F"),talla c(1.83,1.76,
1.82,1.60,1.90,1.66),peso=c(67,58,66,48,75,55),row.names=c("Jose","Maria"
,"Antonio","Marta","Willian","Elsa"))
Error: unexpected symbol in "datos1<-data.frame(Genero=c("M","F","M","F",
"M","F"),talla c"
> datos1<-data.frame(Genero=c("M","F","M","F","M","F"),talla=c(1.83,1.76,
1.82,1.60,1.90,1.66),peso=c(67,58,66,48,75,55),row.names=c("Jose","Maria"
,"Antonio","Marta","Willian","Elsa"))
> edit(datos1)
Genero talla peso
Jose M 1.83 67
Maria F 1.76 58
Antonio M 1.82 66
Marta F 1.60 48
Willian M 1.90 75
Elsa F 1.66 55
> base2<-read.csv("C:/Users/Usuario/Documents/datos R/worms.csv")
> View(base2)
> base2[8:10,4:5]
Vegetation Soil.pH
8 Arable 4.8
9 Orchard 5.7
10 Grassland 5.0
> base2[Area>3 & Slope<3,]
Error in `[.data.frame`(base2, Area > 3 & Slope < 3, ) :
object 'Area' not found
> base2[Area>3&Slope<3,]
Error in `[.data.frame`(base2, Area > 3 & Slope < 3, ) :
object 'Area' not found
> base2[base2$Area>3&base2$Slope<3,]
Field.Name Area Slope Vegetation Soil.pH Damp Worm.density
2 Silwood.Bottom 5.1 2 Arable 5.2 FALSE 7
5 Gunness.Thicket 3.8 0 Scrub 4.2 FALSE 6
6 Oak.Mead 3.1 2 Grassland 3.9 FALSE 2
12 North.Gravel 3.3 1 Grassland 4.1 FALSE 1
13 South.Gravel 3.7 2 Grassland 4.0 FALSE 2
15 Pond.Field 4.1 0 Meadow 5.0 TRUE 6
16 Water.Meadow 3.9 0 Meadow 4.9 TRUE 8
18 Pound.Hill 4.4 2 Arable 4.5 FALSE 5
> base2[base2$Area=2,]
Error: unexpected '=' in "base2[base2$Area="
> base2[base2$Worm.density=2,]
Error: unexpected '=' in "base2[base2$Worm.density="
> base2[base2$Worm.density==2,]
Field.Name Area Slope Vegetation Soil.pH Damp Worm.density
3 Nursery.Field 2.8 3 Grassland 4.3 FALSE 2
6 Oak.Mead 3.1 2 Grassland 3.9 FALSE 2
13 South.Gravel 3.7 2 Grassland 4.0 FALSE 2
> base2[order(Area),]
Error in order(Area) : object 'Area' not found
> base2[order(Area)]
Error in order(Area) : object 'Area' not found
> base2[order(Area),c(2,3,5,7)]
Error in order(Area) : object 'Area' not found
> base2[rev(orden(datos3[5])),c(5,7)]
Error in rev(orden(datos3[5])) : could not find function "orden"
> base2[rev(orden(datos3[,5])),c(5,7)]
Error in rev(orden(datos3[, 5])) : could not find function "orden"
> base2[rev(order(datos3[5])),c(5,7)]
Error in order(datos3[5]) : object 'datos3' not found
> base2[rev(order(datos3[,5])),c(5,7)]
Error in order(datos3[, 5]) : object 'datos3' not found
> base2[rev(order(base2[,5])),c(5,7)]
Soil.pH Worm.density
9 5.7 9
11 5.2 8
2 5.2 7
20 5.1 3
15 5.0 6
10 5.0 7
16 4.9 8
4 4.9 5
8 4.8 4
17 4.7 4
18 4.5 5
3 4.3 2
7 4.2 3
5 4.2 6
12 4.1 1
1 4.1 4
13 4.0 2
6 3.9 2
14 3.8 0
19 3.5 1
> a<-c(2,4,5)
> b<-c(3,6,8)
> a+b
[1] 5 10 13
> a<-matriz (c(7,5,11,2,4,6,8,3,1), nrow=3,ncol=3, byrow=TRUE
+
+
+ a<-matriz (c(7,5,11,2,4,6,8,3,1), nrow=3,ncol=3, byrow=TRUE)
Error: unexpected symbol in:
"
a"
> a<-matriz (c(7,5,11,2,4,6,8,3,1), nrow=3,ncol=3, byrow=TRUE)
Error: could not find function "matriz"
> a<-matrix (c(7,5,11,2,4,6,8,3,1), nrow=3,ncol=3, byrow=TRUE)
> b<-matrix (c(1,3,7,4,2,9,5,7,1), nrow=3,ncol=3, byrow=TRUE)
> b<-matrix (c(1,3,7,4,2,9,5,7,1), nrow=3,ncol=3, byrow=TRUE)
>
> x1<-data.frame(Id=c(1:4),(Genero= c("M","F","F","M"), Wwight=c(75,68,48
,72))
Error: unexpected ',' in "x1<-data.frame(Id=c(1:4),(Genero= c("M","F","F"
,"M"),"
> x1<-data.frame(Id=c(1:4),Genero= c("M","F","F","M"), wight=c(75,68,48,7
2))
> x2<-data.frame(Id=c(1:4),Genero=c("M","F","F","M"),talla=c(182,165,160,
172))
> x<-merge(x1,x2)
> x<-cbind(x1,x2)
> x<-cbind(x1,x2)
> x<-merge(x1,x2)
> View(x)
> summary(base2$peso)
Length Class Mode
0 NULL NULL
> summary(base2$wight)
Length Class Mode
0 NULL NULL
> summary(base2$wight)
Length Class Mode
0 NULL NULL
> attach(x)
> summary(weight)
Error in summary(weight) : object 'weight' not found
> summary(wight)
Min. 1st Qu. Median Mean 3rd Qu. Max.
48.00 63.00 70.00 65.75 72.75 75.00
> rename (restaurante[3])<-precio
Error: object 'precio' not found
> names (restaurante)[3]<-precio
Error: object 'precio' not found
> rename (restaurante)[3]<-precio
Error: object 'precio' not found
> names (restaurant)[3]<-precio
Error: object 'precio' not found
> names (restaurant)["3"]<-precio
Error: object 'precio' not found
> names (restaurant)["3"]<-Precio
Error: object 'Precio' not found
> names (restaurant)["3"]<-"Precio"
Error in names(restaurant)["3"] <- "Precio" :
object 'restaurant' not found
> names (restaurante)["3"]<-Precio
Error: object 'Precio' not found
> names (restaurante)["3"]<-"Precio"
Error in names(restaurante)["3"] <- "Precio" :
object 'restaurante' not found
> rename (restaurante)[3]<-"Precio"
Error in rename(restaurante)[3] <- "Precio" :
object 'restaurante' not found
> rename (restaurante)["3"]<-"Precio"
Error in rename(restaurante)["3"] <- "Precio" :
object 'restaurante' not found
> rename (restaurante)["3"]<-Precio
Error: object 'Precio' not found
> rename (restaurante)["3"]<-"Precio"
Error in rename(restaurante)["3"] <- "Precio" :
object 'restaurante' not found
> names(restaurante)["3"]<-"Precio"
Error in names(restaurante)["3"] <- "Precio" :
object 'restaurante' not found
> names(restaurante)[3]<-"Precio"
Error in names(restaurante)[3] <- "Precio" :
object 'restaurante' not found
> rename (restaurante)["3"]<-Precio
Error: object 'Precio' not found
> rename (restaurante)["3"]<-Precio
Error: object 'Precio' not found
> restaurante<-read.csv("c:/datos/restaurant.csv",sep=",")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'c:/datos/restaurant.csv': No such file or directory
> restaurante<-read.csv("C:/Users/Usuario/Documents/datos R.csv",sep=",")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C:/Users/Usuario/Documents/datos R.csv': No such file
or directory
> restaurante<-read.csv("C:/Users/Usuario/Documents/datos R/Restaurant.cs
v",sep=",")
> rename (restaurante)["3"]<-Precio
Error: object 'Precio' not found
> names (restaurante)[3]<-Precio
Error: object 'Precio' not found
> names (restaurante)[3]<-"Precio"
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/car_2.1-0
.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘car’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘pbkrtest’
Error: package or namespace load failed for ‘car’
> Precio.rec<-as-factor(Precio.rec)
Error in factor(Precio.rec) : object 'Precio.rec' not found
> Precio.rec<-as.factor(Precio.rec)
Error in is.factor(x) : object 'Precio.rec' not found
> precio.rec<-as.factor(precio.rec)
Error in is.factor(x) : object 'precio.rec' not found
> precio.rec<-as.factor(precio.rec)
Error in is.factor(x) : object 'precio.rec' not found
> attach(restaurante)
> precio.rec<-as.factor(precio.rec)
Error in is.factor(x) : object 'precio.rec' not found
> Precio.rec<-as.factor(Precio.rec)
Error in is.factor(x) : object 'Precio.rec' not found
> precio.rec<-as.factor(restaurante$precio.rec)
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/car_2.1-0
.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘car’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘pbkrtest’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/pbkrtest_
0.4-2.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘pbkrtest’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]
) :
there is no package called ‘lme4’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/lme4_1.1-
10.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘lme4’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘minqa’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/pbkrtest_
0.4-2.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘pbkrtest’ successfully unpacked and MD5 sums checked
> precio.rec<-recode(restaurante$precio)
Error: could not find function "recode"
> precio.rec<-recode(restaurante$precio,"10:19"='10 a 19;20:29='20 a 29';
30:39='30 a 39';40:49='40 a 49'")
Error: unexpected numeric constant in "precio.rec<-recode(restaurante$pre
cio,"10:19"='10 a 19;20:29='20"
> precio.rec<-recode(restaurante$precio,"10:19"='10 a 19';20:29='20 a 29'
;30:39='30 a 39';40:49='40 a 49'")
Error: unexpected ';' in "precio.rec<-recode(restaurante$precio,"10:19"='
10 a 19';"
> precio.rec<-recode(restaurante$precio,"10:19"='10 a 19';"20:29"='20 a 2
9';"30:39"='30 a 39';"40:49"='40 a 49'")
Error: unexpected ';' in "precio.rec<-recode(restaurante$precio,"10:19"='
10 a 19';"
> precio.rec<-recode(restaurante$precio,"10:19"='10 a 19';20:29='20 a 29'
;30:39='30 a 39';40:49='40 a 49'")
Error: unexpected ';' in "precio.rec<-recode(restaurante$precio,"10:19"='
10 a 19';"
> precio.rec<-recode(restaurante$precio,"10:19='10 a 19';20:29='20 a 29';
30:39='30 a 39';40:49='40 a 49'")
Error: could not find function "recode"
> precio.rec<-recode(restaurante$precio,"10:19='10 a 19';20:29='20 a 29';
30:39='30 a 39';40:49='40 a 49'")
Error: could not find function "recode"
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘minqa’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/minqa_1.2
.4.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘minqa’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]
) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/Rcpp_0.12
.1.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘Rcpp’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘nloptr’
Error: package or namespace load failed for ‘car’
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘nloptr’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/nloptr_1.
0.4.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘nloptr’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Users\Usuario\Documents\R\win
-library\3.2\file47c6b3434cb\nloptr’ to ‘C:\Users\Usuario\Documents\R\win
-library\3.2\nloptr’
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘nloptr’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/nloptr_1.
0.4.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘nloptr’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘quantreg’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/quantreg_
5.19.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘quantreg’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘SparseM’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/SparseM_1
.7.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘SparseM’ successfully unpacked and MD5 sums checked
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionChec
k = vI[[j]]) :
there is no package called ‘MatrixModels’
Error: package or namespace load failed for ‘car’
> install.packages("C:/Users/Usuario/Desktop/R sofware/Packages/MatrixMod
els_0.4-1.zip", repos = NULL)
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘MatrixModels’ successfully unpacked and MD5 sums checked
> library(car)
>
> library(car)
> precio.rec<-recode(restaurante$precio,"10:19='10 a 19';20:29='20 a 29';
30:39='30 a 39';40:49='40 a 49'")
> Atun<-data.frame(A1=c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1.12
,0.63,0.67,0.60,0.66),A2=c(2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0
.60,0.67))
Error in data.frame(A1 = c(0.99, 1.92, 1.23, 0.85, 0.65, 0.69, 0.6, 0.53,
:
arguments imply differing number of rows: 14, 11
> Atun<-data.frame(A1=c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1.12
,0.63,0.67,0.60,0.66),A2=c(2.56,1.92,1.30,1.79,1.23,NA,NA,0.62,0.66,0.62,
0.65,0.60,0.67,NA))
> view(atun)
Error: could not find function "view"
> View(Atun)
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66),Tipo=c(1:14))
> view(A1)
Error: could not find function "view"
> View(A1)
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66),Tipo=c(1==1))
> View(A1)
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66),Tipo=c(1=1))
Error: unexpected '=' in "A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.
65,0.69,0.60,0.53,1.41,1.12,0.63,0.67,0.60,0.66),Tipo=c(1="
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66),Tipo=c(1=1))
Error: unexpected '=' in "A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.
65,0.69,0.60,0.53,1.41,1.12,0.63,0.67,0.60,0.66),Tipo=c(1="
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66),Tipo=c(1==1))
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,NA,NA,0.62,0.66,0.62,0.6
5,0.60,0.67,NA),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2)
+
+ View(A1)
Error: unexpected symbol in:
"
View"
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
+ View(A1)
Error: unexpected symbol in:
"A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1.
12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60,
0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,
View"
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
+
+
+
+ A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
Error: unexpected symbol in:
"
A1"
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
+ A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
Error: unexpected symbol in:
"A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1.
12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60,
0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,
A1"
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
+
+
+
+
+
+ View(A1)
Error: unexpected symbol in:
"
View"
>
> View(A1)
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2)
+
+
+
+
+ A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2))
Error: unexpected symbol in:
"
A1"
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2))
> View(A1)
> library(car)
> Tipo.rec<-recod(A1$Tipo,"1='Agua';2='Aceite'")
Error: could not find function "recod"
> Tipo.rec<-recode(A1$Tipo,"1='Agua';2='Aceite'")
> Tipo.rec<-as.factor(Tipo.rec)
> View(A1)
> tabla<-table(Precio,Tipo.rec)
Error in table(Precio, Tipo.rec) :
all arguments must have the same length
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> View(A1)
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> tabla<-table(Precio,Tipo.rec)
Error in table(Precio, Tipo.rec) :
all arguments must have the same length
> tabla<-tableA1(Precio,Tipo.rec)
Error: could not find function "tableA1"
> tabla<-table(Precio,Tipo.rec)
Error in table(Precio, Tipo.rec) :
all arguments must have the same length
> t.test(Tipo~precio,A1)
Error in t.test.formula(Tipo ~ precio, A1) :
grouping factor must have exactly 2 levels
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> t.test(precio,Tipo)
Error in t.test(precio, Tipo) : object 'precio' not found
> A1<-data.frame(precio= c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1
.12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60
,0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2))
> Tipo.rec<-recode(A1$Tipo,"1='Agua';2='Aceite'")
> Tipo.rec<-as.factor(Tipo.rec)
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> A1<-data.frame(precio=c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1.
12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60,
0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2))
> Tipo.rec<-recode(A1$Tipo,"1='Agua';2='Aceite'")
> Tipo.rec<-as.factor(Tipo.rec)
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> A1<-data.frame(Precio=c(0.99,1.92,1.23,0.85,0.65,0.69,0.60,0.53,1.41,1.
12,0.63,0.67,0.60,0.66,2.56,1.92,1.30,1.79,1.23,0.62,0.66,0.62,0.65,0.60,
0.67),Tipo=c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2))
> Tipo.rec<-recode(A1$Tipo,"1='Agua';2='Aceite'")
> Tipo.rec<-as.factor(Tipo.rec)
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> tabla<-table(Precio,Tipo.rec)
Error in table(Precio, Tipo.rec) :
all arguments must have the same length
> tabla<-table(precio,Tipo.rec)
Error in table(precio, Tipo.rec) : object 'precio' not found
> AUTO<-data.frame(Id=c(1:5),TipoA=c(10.6,9.8,12.3,9.7,8.8),TipoB=c(10.2,
9.4,11.8,9.1,8.3))
> View(AUTO)
> MEDIa<-tapply(AUTO$TipoA,TipoB, mean)
Error in tapply(AUTO$TipoA, TipoB, mean) : object 'TipoB' not found
> mean(AUTO)
[1] NA
Warning message:
In mean.default(AUTO) : argument is not numeric or logical: returning NA
> mean(TipoA)
Error in mean(TipoA) : object 'TipoA' not found
> mean(TipoA)
Error in mean(TipoA) : object 'TipoA' not found
> TipoA=c(10.6,9.8,12.3,9.7,8.8)
> TipoB=c(10.2,9.4,11.8,9.1,8.3)
> mean(TipoA)
[1] 10.24
> mean(TipoB)
[1] 9.76
> whit(datos,t.test(TipoA,TipoB), paired=TRUE)
Error: could not find function "whit"
> with(datos,t.test(TipoA,TipoB), paired=TRUE)
Error in with(datos, t.test(TipoA, TipoB), paired = TRUE) :
object 'datos' not found
> with(AUTO,t.test(TipoA,TipoB),paired=TRUE)

Welch Two Sample t-test

data: TipoA and TipoB


t = 0.57404, df = 7.9994, p-value = 0.5817
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-1.448263 2.408263
sample estimates:
mean of x mean of y
10.24 9.76

> wilcox.test(TipoA~TipoB,AUTO)
Error in wilcox.test.formula(TipoA ~ TipoB, AUTO) :
grouping factor must have exactly 2 levels
> wilcox.test(Precio~Tipo,AUTO)
Error in eval(expr, envir, enclos) : object 'Tipo' not found
> wilcox.test(precio~Tipo,AUTO)
Error in eval(expr, envir, enclos) : object 'precio' not found
> wilcox.test(Tipo~precio,AUTO)
Error in eval(expr, envir, enclos) : object 'Tipo' not found
> wilcox.test(Tipo~precio,AUTO)
Error in eval(expr, envir, enclos) : object 'Tipo' not found
> wilcox.test(Tipo~precio,AUTO)
Error in eval(expr, envir, enclos) : object 'Tipo' not found
>
> datos<-data.frame(Valores=c(26,29,23,24,28,26),tratamiento=c())
Error in data.frame(Valores = c(26, 29, 23, 24, 28, 26), tratamiento = c(
)) :
arguments imply differing number of rows: 6, 0
> p67<-data.frame(Valores=c(26,29,23,24,28,26,27,31,30,28,29,32,30,33,25,
24,27,22,24,20,21),tratamiento=c(1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,
3))
> View(p67)
> savehistory("~/datos R/practica de clase(borrador).Rhistory")
> Kruskal.test(Valores~tratamiento,p67)
Error: could not find function "Kruskal.test"
> kruskal.test(Valores~tratamiento,p67)

Kruskal-Wallis rank sum test

data: Valores by tratamiento


Kruskal-Wallis chi-squared = 13.471, df = 2, p-value = 0.001188

> barplot(tabla)
Error in barplot(tabla) : object 'tabla' not found
>
> my.data<-read.table(file=file.choose(),header=TRUE,sep="nt",dec=".",row
.names=1)my.data<-read.table(file=file.choose(),header=TRUE,sep="nt",dec=
".",row.names=1)
Error: unexpected symbol in "my.data<-read.table(file=file.choose(),heade
r=TRUE,sep="nt",dec=".",row.names=1)my.data"
> worms<-read.table(file=file.choose(),header=TRUE,sep="nt",dec=".",row.n
ames=1)
Error in file.choose() : file choice cancelled
> worms<-read.table("C:/datos/worms)
+ worms<-read.table("C:/datos/worms.csv)
Error: unexpected symbol in:
"worms<-read.table("C:/datos/worms)
worms<-read.table("C"
> worms<-read.table("C:/datos/worms.csv")
> View(worms)
> C:\Users\Usuario\Documents\datos R
Error: unexpected input in "C:\"
>
> worms<-read.table("C:/Users/Usuario/Documents/datos R/worms.csv")
> View(worms)
> summary(worms)
V1
Ashurst,2.1,0,Arable,4.8,F,4 : 1
Cheapside,2.2,8,Scrub,4.7,T,4 : 1
Church.Field,3.5,3,Grassland,4.2,F,3 : 1
Farm.Wood,0.8,10,Scrub,5.1,T,3 : 1
Field.Name,Area,Slope,Vegetation,Soil.pH,Damp,Worm.density: 1
Garden.Wood,2.9,10,Scrub,5.2,F,8 : 1
(Other) :15
> base2<-read.csv("C:/Users/Usuario/Documents/datos R/worms.csv")
> View(base2)
> summary(base2)
Field.Name Area Slope Vegetation Soil
.pH
Ashurst : 1 Min. :0.800 Min. : 0.00 Arable :3 Min.
:3.500
Cheapside : 1 1st Qu.:2.175 1st Qu.: 0.75 Grassland:9 1st Qu.
:4.100
Church.Field: 1 Median :3.000 Median : 2.00 Meadow :3 Median
:4.600
Farm.Wood : 1 Mean :2.990 Mean : 3.50 Orchard :1 Mean
:4.555
Garden.Wood : 1 3rd Qu.:3.725 3rd Qu.: 5.25 Scrub :4 3rd Qu.
:5.000
Gravel.Pit : 1 Max. :5.100 Max. :11.00 Max.
:5.700
(Other) :14
Damp Worm.density
Mode :logical Min. :0.00
FALSE:14 1st Qu.:2.00
TRUE :6 Median :4.00
NA's :0 Mean :4.35
3rd Qu.:6.25
Max. :9.00
> recode(base2$Soil.pH,"3.5:4.1='3.5to4.1;4.1:4.6='4.1to4.6';4.6:5='4.6to
5'")
Error in recode(base2$Soil.pH, "3.5:4.1='3.5to4.1;4.1:4.6='4.1to4.6';4.6:
5='4.6to5'") :

in recode term: 3.5:4.1='3.5to4.1


message: Error in parse(text = strsplit(term, "=")[[1]][2]) :
<text>:1:1: unexpected INCOMPLETE_STRING
1: '3.5to4.1
^
>

>

> worms<-read.table("C:/Users/Usuario/Documents/datos R/worms.csv")


> View(worms)
> base2<-read.csv("C:/Users/Usuario/Documents/datos R/worms.csv")
> View(base2)
> summary(base2)
Field.Name Area Slope Vegetation Soil
.pH
Ashurst : 1 Min. :0.800 Min. : 0.00 Arable :3 Min.
:3.500
Cheapside : 1 1st Qu.:2.175 1st Qu.: 0.75 Grassland:9 1st Qu.
:4.100
Church.Field: 1 Median :3.000 Median : 2.00 Meadow :3 Median
:4.600
Farm.Wood : 1 Mean :2.990 Mean : 3.50 Orchard :1 Mean
:4.555
Garden.Wood : 1 3rd Qu.:3.725 3rd Qu.: 5.25 Scrub :4 3rd Qu.
:5.000
Gravel.Pit : 1 Max. :5.100 Max. :11.00 Max.
:5.700
(Other) :14
Damp Worm.density
Mode :logical Min. :0.00
FALSE:14 1st Qu.:2.00
TRUE :6 Median :4.00
NA's :0 Mean :4.35
3rd Qu.:6.25
Max. :9.00

> soil.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.6:5


='4.6 a 5'; 5.1:5.7='5.1 a 5.7'"))
Error: unexpected ')' in "soil.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4
.2:4.6='4.2 a 4.6',4.6:5='4.6 a 5'; 5.1:5.7='5.1 a 5.7'"))"
> soil.ph.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.
7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'"))
Error: unexpected ')' in "soil.ph.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1
';4.2:4.6='4.2 a 4.6',4.7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'"))"
> soil.ph.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.
7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
Error in is.factor(var) : object 'Soil.pH' not found
> soil.ph.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.
7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
Error in is.factor(var) : object 'Soil.pH' not found
> soil.ph.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.
7:5='4.7 a 5';5.1:5.7='5.1 a 5.7'")
Error in is.factor(var) : object 'Soil.pH' not found
> Soil.pH.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.
7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
Error in is.factor(var) : object 'Soil.pH' not found
> Soil.pH.rec<-recode(Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4.
7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
Error in is.factor(var) : object 'Soil.pH' not found
> Soil.pH.rec<-recode(base2$Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4
.6',4.7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
Error in recode(base2$Soil.pH, "3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6',4
.7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'") :

in recode term: 4.2:4.6='4.2 a 4.6',4.7:5='4.7 a 5'


message: Error in parse(text = strsplit(term, "=")[[1]][2]) :
<text>:1:12: unexpected ','
1: '4.2 a 4.6',
^
> Soil.pH.rec<-recode(base2$Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4
.6';4.7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
> soil.rec<-recode(base2$Soil.pH,"3.5:4.1='3.5 a 4.1';4.2:4.6='4.2 a 4.6'
;4.7:5='4.7 a 5'; 5.1:5.7='5.1 a 5.7'")
> soil<-asfactor(soil.rec)
Error: could not find function "asfactor"
> soil<-as.factor(soil.rec)
> tabla<-table(vegetation,soil.rec)
Error in table(vegetation, soil.rec) : object 'vegetation' not found
> tabla<-table(Vegetation,soil.rec)
Error in table(Vegetation, soil.rec) : object 'Vegetation' not found
> tabla<-table(base2$Vegetation,soil.rec)
> tabla
soil.rec
3.5 a 4.1 4.2 a 4.6 4.7 a 5 5.1 a 5.7
Arable 0 1 1 1
Grassland 6 2 1 0
Meadow 0 0 3 0
Orchard 0 0 0 1
Scrub 0 1 1 2
> kruskal.test(soil.pH~Vegetation,base2)
Error in eval(expr, envir, enclos) : object 'soil.pH' not found
> kruskal.test(soil~Vegetation,base2)

Kruskal-Wallis rank sum test


data: soil by Vegetation
Kruskal-Wallis chi-squared = 12.126, df = 4, p-value = 0.01644

> barplot(tabla2,col=c("pink","purple","skyblue","green"))
Error in barplot(tabla2, col = c("pink", "purple", "skyblue", "green")) :
object 'tabla2' not found
> barplot(base2,col=c("pink","purple","skyblue","green"))
Error in barplot.default(base2, col = c("pink", "purple", "skyblue", "gre
en")) :
'height' must be a vector or a matrix
> barplot(tabla,col=c("pink","purple","skyblue","green"))
> barplot(tabla,col=c("pink","purple","skyblue","yellow"))
> savehistory("~/datos R/practica de clase(borrador).Rhistory")

Das könnte Ihnen auch gefallen