I am trying to plot linear regression between two parameters from my data set. But I am not able to do so, I am getting an error
Error in plot.default(yh, r, xlab = l.fit, ylab = "Residuals", main = main, : formal argument "xlab" matched by multiple actual arguments
Here is my code
file <- "bank.csv"
data <- read.csv(file, header=TRUE, sep=";")
data <- data[(data$Previous_Outcome == "success") | (data$Previous_Outcome == "nonexistent"),]
data <- data[(data$Duration != "0"),]
age = data$Age
duration <- data$Duration
fit <- lm(age ~ duration)
png(filename = "AgevsDurationRegression.png", width=480, height=480, units="px")
> plot(fit, main="Age vs Call Duration Regression", xlab = "Duration in Seconds", ylab = "Age in Years")
Error in plot.default(yh, r, xlab = l.fit, ylab = "Residuals", main = main, :
formal argument "xlab" matched by multiple actual arguments
str(data) and summary(fit) gave me this
summary(fit)
Call:
lm(formula = age ~ duration)
Residuals:
Min 1Q Median 3Q Max
-23.063 -8.045 -2.027 6.956 58.007
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 40.0792439 0.0752589 532.551 <2e-16 ***
duration -0.0001804 0.0002040 -0.884 0.377
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 10.28 on 36930 degrees of freedom
Multiple R-squared: 2.117e-05, Adjusted R-squared: -5.903e-06
F-statistic: 0.782 on 1 and 36930 DF, p-value: 0.3765
plot.lm()
. this function has no parameterxlab=
. Useplot(age ~ duration)
(orplot(duration, age)
) and after fittingabline(fit)
. – jogo