I'm sorry but where is 28 coming from? It looks to me like you have a vector of length 34 and the result is of length 34. Oh, I see, the 28 and 29 are the indices for the first number on the line not the total length.
John Kane Kingston ON Canada > -----Original Message----- > From: mmbal...@mtu.edu > Sent: Mon, 7 May 2012 12:26:15 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] Subtracting a matrix 1x28 from a scalar > > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.