Forum Discussion
Gracie
Helper II
9 years agoHow to put x as dates for R linear regression
I am writing R script to do linear regression. My dateset is date and price. Date is from Date table and Price is from Sales table. These two tables have no relationship setup. How can I put date as ...
v-huizhn-msft
Microsoft Employee
9 years agoHi Gracie,
Please create a index column in Date and Sales table separately. Then merge the two table to one according to index field.
Then you load the Index, Date and Price to create a dataset.
Change your corresponding part of code to the following code.
strDates <- dataset[,3]
y <- as.numeric(dataset[,3])
Then run your R code and change if it works fine.
Best Regards,
Angelia
Gracie
Helper II
9 years ago
It doesn't work. I guess your point is to add the index to avoid removing duplicated rows. But the x-axis still can't show as dates.
- v-huizhn-msft9 years ago
Microsoft Employee
Hi Gracie,
>>But the x-axis still can't show as dates.
Could you please share a screenshot for further analysis?
Thanks,
Angelia