Suppose \begin{align} \int_R f(x,y)\,dx & = g(y) \\ \int_R f(x,y)\,dy & = h(x) \end{align}
Then $f_2(x,y) = \dfrac{g(y)h(x)}{\int_{\mathbb R^2}f(u,v)\,du\,dv}$ is a function that has these same two "marginals", i.e. if you put $f_2$ where $f$ appeared above, the integrals come out the same. So must $f=f_2$? Certainly not: for example, let $ f = f_2 + 1_{[0,1]^2} - 1_{[-1,0]^2} $ where the subscripted $1$s are indicator functions of the sets identified in the subscripts.
PS: Maybe you intended both integrals to be with respect to $x$, as you wrote, but in that case your question is rather oddly phrased. You said "Suppose I have [ . . . ] a function $f$". Meaning $f$ is given. The value of $\int_\mathbb R f(x,y)\,dx$ is then uniquely determined as a function of $y$; it doesn't make sense to speak of it's being equal to two different functions. If the question is whether $f$ is determined by that function, the answer is no: suppose $f=0$ except within $[0,1]\times\mathbb R$, and let $k(x,y) = f(x+5,y)$. Then $k$ differs from $f$ but their integrals with respect to $x$ are equal.