[R] Subtracting a matrix 1x28 from a scalar

meredith mmballar at mtu.edu
Mon May 7 21:26:15 CEST 2012


Afternoon-
  I am trying to subtract a matrix, basically a vector of 28 values, each by
the same number to account for differences in regression fitting. I am
taking the 1x28 and minus it by the mean value of the matrix, each number.
The result I receive is a 1X29 matrix. Does anyone know why the result has
an extra value?

> lffeb_march
 [1] 6.588926 7.663877 6.917706 6.824374 7.029973 6.549651 6.517671 6.070738
5.916202
[10] 6.993933 6.091310 7.313220 5.135798 6.762730 6.381816 7.999679 6.851185
5.799093
[19] 7.774856 6.956545 8.218787 8.218787 7.549609 7.222566 7.170120 6.173786
5.075174
[28] 4.700480 6.672033 5.198497 4.867534 7.170120 6.131226 6.802395 
> meanf_fm<-mean(lffeb_march)
> X3_fm<-(lffeb_march-meanf_fm)
> X3_fm
 [1] -0.03784990  1.03710088  0.29092923  0.19759729  0.40319653 -0.07712564
-0.10910511
 [8] -0.55603865 -0.71057432  0.36715660 -0.53546650  0.68644401 -1.49097794 
0.13595313
[15] -0.24496036  1.37290220  0.22440855 -0.82768372  1.14807939  0.32976906 
1.59201078
[22]  1.59201078  0.92283279  0.59578964  0.54334317 -0.45299027 -1.55160256
-1.92629601
[29]  0.04525657 -1.42827935 -1.75924193  0.54334317 -0.49554989  0.17561839

Thanks for the help
Meredith

--
View this message in context: http://r.789695.n4.nabble.com/Subtracting-a-matrix-1x28-from-a-scalar-tp4615590.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list