> length(Sweden.GDP.gap.adjust) [1] 8 > Sweden.GDP.gap.adjust [1] 0.673792123 1.196706756 1.196131539 0.646944002 -0.312886525 [6] -1.706584861 -0.369401194 -0.003280389
R is reading Sweden.GDP.gapp.adjust as having 8 elements. Why I don't know. John Kane Kingston ON Canada > -----Original Message----- > From: bahman.za...@comhem.se > Sent: Mon, 30 Apr 2012 02:43:32 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] Different varable lengths > > Hi! > > I'm trying to do a lm() test on three objects. My problem is that R > protests > and says that the variable lengths differ for one of the objects > (Sweden.GDP.gap). But I have double checked that the number of > observations > are the same. All three objects should contain 9 observations but R only > accepts 9 observations in two of the objects. The third must have 10! > Very > confusing because there is no 10th observation! > > # Adjusted Real rate - P >> Sweden.p.adjust <- c(4.70243, 1.3776655, 1.117755, 1.6695175, 1.59282, >> 1.1017625, -0.04295, 2.2552875, 0.0552875) >> >> # Adjusted Inflation deviation >> Sweden.infl.dev.adjust <- c(0.110382497, -0.261612509, 0.040847515, >> -0.195062497, -0.234362485, -0.023408728, 0.206421261, -0.079401261, >> 0.071828752) >> >> # Adjusted GDP-gap >> Sweden.GDP.gap.adjust <- c(0.673792123, 1.196706756, 1.196131539, >> 0.646944002, -0.312886525, -1.180620213 -0.525964648, -0.369401194, >> -0.003280389) >> >> # OLS regression using ADJUSTED data.# >> Sweden.Taylor.real.adjust <- lm(Sweden.p.adjust ~ Sweden.infl.dev.adjust >> + >> Sweden.GDP.gap.adjust) > Error in model.frame.default(formula = Sweden.p.adjust ~ > Sweden.infl.dev.adjust + : > variable lengths differ (found for 'Sweden.GDP.gap.adjust') > > Why is this happening? > > / Saint > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Different-varable-lengths-tp4597768.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. ____________________________________________________________ TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if5 Capture screenshots, upload images, edit and send them to your friends through IMs, post on Twitter®, Facebook®, MySpace™, LinkedIn® – FAST! ______________________________________________ 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.