I would like to prove the following statement. Let $n \in \mathbb{N}$ be arbitrary and $\emptyset \neq S \subseteq \mathbb{R}^n$. Then $\phi : S \rightarrow \mathbb{R}$ is affine iff there exists $\alpha_1, ..., \alpha_n, \beta$, each of them $\in \mathbb{R}$, such that $\phi(x) = \sum_{i=1}^n\alpha_ix_i \ + \beta$, for all $x \in S.$
I am familiar with the fact that, provided that $0 \in S$, $\phi \in \mathbb{R}^S$ is affine iff $\phi - \phi(0)$ is a linear map on $S$ and I believe this will be useful.
I don't know what definition of affine you're given, but I'm guessing it'll be helpful for you to know this fact:
Fix a choice of $v_0 \in S$. Then $\phi$ is affine if and only if the function $$S-v_0 \to \mathbb R$$ given by $$w \mapsto \phi(w+v_0)$$ is affine. Here $S-v_0$ denotes the set $\{v-v_0\mid v \in S\}$.
This reduces your problem to understanding that transformation between $S$ and $S-v_0$ and handling the case $0 \in S$. See if you can prove that and then use it together with the fact you quoted.