Function with limits only at irrational points This is the starred example 5.1.8 in Krantz' Real Analysis and Foundations.

Give an example of a function $f: \mathbb{R} \rightarrow \mathbb{R}$ so that $\lim_{x\rightarrow c} f(x)$ exists when $c$ is irrational but does not exist when $c$ is rational.

I'm aware of the Dirichlet and Thomae functions but this seems slightly different. I'm not even sure a solution exists. Thanks for any help!
 A: New: In fact more or less the same argument shows that given $E\subset\Bbb R$ there exists $f:\Bbb R\to\Bbb R$ such that $E$ is the set where $f$ fails to have a limit if and only if $E$ is an $F_\sigma$ (a countable union of closed sets). First the answer to the OP, where $E=\Bbb Q$:
Say $g(x)=\sin(1/x)$ for $x\ne0$, $g(0)=0$. Let $r_1,\dots$ be an enumeration of the rationals. Let $$f(x)=\sum_n3^{-n}g(x-r_n).$$
If $c$ is irrational then $f$ has a limit at $c$ because of uniform convergence.
Suppose $c=r_N$. Now $\sum_{n=1}^{N-1}$ is continuous at $c$, so we need only show that $\sum_{n=N}^\infty$ fails to have a limit at $c$. This follows from the fact that $$3^{-N}>\sum_{n=N+1}^\infty3^{-n}.$$
(The key phrase here is "condensation of singularities"...)

Edit In detail: Let's define $$\omega(\phi)=\limsup_{x,y\to r_N}|\phi(x)-\phi(y)|,$$so that $\phi$ has a limit at $r_N$ if and only if $\omega(\phi)=0$.
Write $f=f_1+f_2+f_3=\sum_{n=1}^{N-1}+\sum_{n=N}^N+\sum_{n=N+1}^\infty$. Then $$\omega(f)\ge\omega(f_2)-(\omega(f_1)+\omega(f_2))=\omega(f_2)-\omega(f_3)\ge 2(3^{-N}-\sum_{n=N+1}^\infty 3^{-n})>0.$$

New: 
Theorem Suppose $E\subset \Bbb R$. There exists $f:\Bbb R\to\Bbb R$ such that $E$ is the set of points where $f$ does not have a limit if and only if $E$ is an $F_\sigma$.
Suppose first that $f:\Bbb R\to\Bbb R$. Let $V_n$ be the set of $x$ such that there exists $\delta>0$ with $|f(s)-f(t)|<1/n$ for all $s,t\in(x-\delta,x)\cup(x,x+\delta)$. Then $V_n$ is clearly open and $\bigcap V_n$ is the set of points where $f$ has a limit.
For the other direction, define as above $$\omega_x(f)=\limsup_{s,t\to x}|f(s)-f(t)|.$$
Lemma If $K\subset\Bbb R$ is closed then there exists $f:\Bbb R\to[-1,1]$ such that $f$ is continuous on $\Bbb R\setminus K$ and $\omega_x(f)=2$ for every $x\in K$.
Proof: Say the complement of $K$ is the union of the disjoint open intervals $I_j$. Define $f$ on $I_j$ to be a continuous function that oscillates in a $\sin(1/x)$ sort of way as you approach either endpoint of $I_j$. If $x\in K$ let $f(x)=1$ if $x$ is rational, $-1$ if $x$ is irrational. To show that $\omega_x(f)=2$ for every $x\in K$ consider the two cases where $x$ is an interior point of $K$ or a boundary point. QED.
Proof of the other half of the theorem: Say $E=\bigcup K_n$ where each $K_n$ is closed. Let $f_n$ be as in the lemma, with $K=K_n$. Let $$f=\sum_n3^{-n}f_n.$$As before, $f$ has a limit at every point of $\Bbb R\setminus E$ by uniform convergence.
Suppose $x\in E$. There exists $N$ so $x\in K_N\setminus\bigcup_{n=1}^{N-1}K_n$. As above it follows that $$\omega_x(f)\ge2(3^{-N}-\sum_{n=N+1}^\infty3^{-n})>0.$$
