This is a series RC circuit. The expression for charge as a function of time on the capacitor during charging is thus:
q(t) = Qmax(1 - e-(t/RC))
This can be derived by setting up a differential equation using Kirchhoff's loops rule around the series circuit, but this derivation is typically done once, after which we just use the above result. We can go through the derivation, if you like.
Notice that, at t=0, just after charging has begun, there is no charge yet on the capacitor. After a long time (t --> ∞), the charge on the capacitor approaches, in the limit, a maximum value (=CVbat, where C is the capacitance and Vbat is the EMF of the battery, as prescribed by the relationship between charge, voltage, and capacitance in a capacitor: C = Q/V --> Q = CV).
RC is called the time constant, and determines how quickly the capacitor charges (and discharges). It is by calculating this value that we can determine the resistance... but we also need to know the capacitance, C, of the capacitor.
The capacitance C can be determined because we know from the graph that Qmax = CVbat = 20 μC = 20 x 10-6 C. Since we know Vbat = 5 V, we can solve for C in farads.
Once C is known, we can solve for R using the charging equation, if we know q(t) for a particular time. From the graph, we known q(t) = 12.6 μC when t = 6 s. Plugging that, and the values for C and for Qmax into the charging equation leaves R as the only unknown. Just solve that expression for R (hint: you will need to take a natural log along the way).
Using this method, I did get a result for R ~ 1.51 MΩ
If you want to go into more detail about this or other problems, I am available for online tutoring sessions. Just let me know!