1
我在運行劇情代碼時出現以下錯誤:Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
。我的數據集中有很多NA
s,據我瞭解這是導致問題的原因。任何想法:xy.coords在處理NA時出錯
- 如何R中處理NAS和
- 如何確保我可以積的變量地塊有不同的長度?
我看了一些類似的問題發佈在這裏,但不幸的是無法理解它。不用說,我是新來的R.
df <- read.dta("r12.dta")
attach(df)
model1 <- lm(rent~I(income^2)+income*races)
fitted(model1)
layout(matrix(1:4,2,2))
plot(model1)
plot(income, fitted(model1), xlab="Income", ylab="Rent",
main="Fitted Values for Black Rent",type="l")
感謝您編輯和回覆我的帖子。偉大的建議,再次感謝! – torentino