datos=c(6,3,7,4,5,3)
A=matrix(data=datos,nrow=3,ncol = 2,byrow=FALSE)
print(A*3)
## [,1] [,2]
## [1,] 18 12
## [2,] 9 15
## [3,] 21 9
matA<-matrix(data=c("a","b","d","e","f"), nrow=3,ncol=2,byrow=TRUE)
## Warning in matrix(data = c("a", "b", "d", "e", "f"), nrow = 3, ncol = 2, : data
## length [5] is not a sub-multiple or multiple of the number of rows [3]
rownames(matA)<-c("Fila1","Fila2","Fila3")
colnames(matA)<-c("col1","col2")
x<-c(0,1,2,3,4,5)
y<-c(0.5,1.4,1.98,3.1,3.8,5.4)
formula1<-formula(y~x)
modelo<-lm(formula1)
summary(modelo)
##
## Call:
## lm(formula = formula1)
##
## Residuals:
## 1 2 3 4 5 6
## 0.14762 0.10990 -0.24781 -0.06552 -0.30324 0.35905
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.35238 0.20485 1.72 0.160511
## x 0.93771 0.06766 13.86 0.000157 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.283 on 4 degrees of freedom
## Multiple R-squared: 0.9796, Adjusted R-squared: 0.9745
## F-statistic: 192.1 on 1 and 4 DF, p-value: 0.0001571
plot(x,y)
abline(0.35238,0.93771,col="yellow")
