Error while using decompose and stl functions in R

I am new to time series analysis and I am trying out some codes seen in some tutorials. I am using stock prices as the time series data.

library(quantmod)
aapl=getSymbols("AAPL",from="2015-01-01",auto.assign=F)
is.ts(aapl)
ts.aapl=as.ts(aapl)
is.ts(ts.aapl)
x=Cl(ts.aapl)
plot(decompose(s))
plot(stl(x))


But its showing these errors

> plot(decompose(x))
Error in decompose(x) : time series has no or less than 2 periods
> plot(stl(x))
Error in stl(x) : series is not periodic or has less than two periods


is the error is due to its lack of seasonality and trend?

The error is likely due to the fact that your x is an irregular time series: there are temporal gaps, e.g. no data on 2015-01-03, 2015-01-04. You will have to implement your own version of decompose, e.g. following this approach: