Let's say I have this sample data:
| Month |
Spend |
Sales |
| 1 |
1000 |
9914 |
| 2 |
4000 |
40487 |
| 3 |
5000 |
54324 |
If I want to build a model I would do something like this:
dataset = read.csv("data-marketing-budget-12mo.csv", header=T)
simple.fit = lm(Sales~Spend, data=dataset)
summary(simple.fit)
but I want to be able to do it like this:
dataset = read.csv("data-marketing-budget-12mo.csv", header=T)
simple.fit = lm(dataset[3]~dataset[2], data=dataset)
summary(simple.fit)