Linear regression can be used to model the Time Series data with linear indices (Ex: 1, 2,...n). The resulting model’s residuals are a representation of the time series devoid of the trend. In case, if some trend is left over to be seen in the residuals (like what it seems to be with ‘Figure1’ with myData below as an example), then you might wish to add few predictors to the lm() call (like a forecast:: seasonal dummy, forecast::Fourier or may be a lag of the series itself), until the trend is filtered. Code snippet: trModel <- lm(myData ~ c(1:length(myData)))
plot(resid(trModel), type="l")  # resid(trModel) contains the de-trended series