I am trying to run an R application, but I receive the following first error :
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases Calls: lm -> lm.fit
The code which generates the error is :
pppb = lm(Exchange.rate.change ~ Inflation.difference)
I am new to R and is really hard for me to find the mistake, so any help it is really appreciated. This is a minimal data set:
Country Inflation.difference Exchange.rate.change Developed
Australia -1.235100000e+000 -3.187000000e+000 1.000000000e+000
Austria 1.550800000e+000 1.478100000e+000 1.000000000e+000
Belgium 1.037100000e+000 3.950000000e-002 1.000000000e+000
Canada 4.610000000e-002 -1.641600000e+000 1.000000000e+000
Chile -1.841260000e+001 -2.063290000e+001 0.000000000e+000
This is the minimal runnable code necessary to reproduce the error :
ppp = read.table("test.dat",sep="\t", header=TRUE, row.names=NULL)
attach(ppp)
Developed[Developed==1] = "Developed"
newppp = ppp[ppp$Country!="Brazil",]
attach(newppp)
developed = newppp[Developed==1,]
attach(developed)
pppb = lm(Exchange.rate.change ~ Inflation.difference)
This is the second error I get :
The following object is masked by .GlobalEnv: Developed The following objects are masked from ppp: Country, Developed, Exchange.rate.change, Inflation.difference The following object is masked by .GlobalEnv: Developed The following objects are masked from newppp: Country, Developed, Exchange.rate.change, Inflation.difference The following objects are masked from ppp: Country, Developed, Exchange.rate.change, Inflation.difference
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases Calls: lm -> lm.fit Execution halted `
dput(head(Exchange.rate.change,5)) - c(-3.187, 1.4781, 0.0395, -1.6416, -20.6329)
dput(head(Inflation.difference,5)) - c(-1.2351, 1.5508, 1.0371, 0.0461, -18.4126)
So they don't seem to be NA. – Sam StewartCountry Inflation difference Exchange rate change Developed Australia -1.235100000e+000 -3.187000000e+000 1.000000000e+000 Austria 1.550800000e+000 1.478100000e+000 1.000000000e+000 Belgium 1.037100000e+000 3.950000000e-002 1.000000000e+000
– Sam Stewart