This seems very related to How to display every 4th row in a large data file using pgfplotstable?. I just try to plot the filtered rows but am missing something here. Here is the MWE (I copied the example from previous link).
\pgfplotstableread{
obs number
1 2
2 5
3 3
4 2
5 4
6 1
7 2
8 5
9 3
10 2
11 4
12 1
}\loadedtable
\pgfplotstabletypeset[
row predicate/.code={%
\pgfplotstablegetelem{#1}{obs}\of{\loadedtable}
\pgfmathparse{int(Mod(\pgfplotsretval,4)}
\ifnum \pgfmathresult = 0
\else \pgfplotstableuserowfalse
\fi}
]{\loadedtable}
\begin{tikzpicture}
\begin{axis}
\addplot[only marks,
x filter/.code={\pgfplotstablegetelem{\coordindex}{obs}\of{\loadedtable}
\pgfmathparse{int(Mod(\pgfplotsretval, 4))}
\ifnum \pgfmathresult = 0
\else
\def \pgfmathresult{}
\fi},
] table[x=obs,y=number] {\loadedtable};
\end{axis}
\end{tikzpicture}
The tabletypeset works fine but the plot does not work. Is there an easy fix?
On a side note, is there anyway to save the filtered table as a new macro so that I can use it in a plot directly?
Any help is appreciated.

pgfplotstable? – Zhen Sun Aug 05 '14 at 18:37