Skip to Content

Fixing bug in geom_smooth method in R

I want to create a smooth curve plot for the data I have. I have data in a text file, say file.txt which is a tab seperated file and headers are A and B like

A    B
0.1  0.2

There are about 30000 such data points under both A and B

I am using the following code for that:

dstr_data <- read.table("file.txt", header=T, sep="\t")
colour="darkgreen",alpha=0.5,size=0.75)+opts(title=expression("Test Plot"),
panel.background = theme_rect(fill='blanchedalmond', colour='black'))+
geom_smooth: method="auto" and size of largest group is >=1000, 
so using gam with formula: y ~ s(x, bs = "cs"). Use 'method = x' to change the smoothing method.

xaxis in my code holds numbers from 1 to 30000. So my X-axis would be numbers from 1 to 30000. Y-axis would be values from the file.txt. So, I am trying to plot two curves on one graph now.

I want to know why this Error is displayed and how I can fix it. I want to use a method that gives me a smooth curve of the data and not a straight line and hence I do not want to use the lm,glm methods.

Also I get the graph only for a subset of data and not the entire data. Why does this happen?

Can someone help me in this? Thank you in advance.