The $p_{\rm T}$-differential production cross section of prompt $\Lambda_{\rmc}^+$ charmed baryons was measured with the ALICE detector at the Large HadronCollider (LHC) in pp collisions at $\sqrt{s} = 7$ TeV and in p-Pb collisions at$\sqrt{s_{\rm NN}} = 5.02$ TeV at midrapidity. The $\Lambda_{\rm c}^+$ and${\overline{\Lambda}}_{\rm c}^-$ were reconstructed in the hadronic decay modes$\Lambda_{\rm c}^+\rightarrow {\rm p}{\rm K^-}\pi^+$, $\Lambda_{\rmc}^+\rightarrow {\rm p}{\rm K_{\rm S}^0}$ and in the semileptonic channel$\Lambda_{\rm c}^+\rightarrow {\rm e^+}\nu_{\rm e}\Lambda$ (and chargeconjugates). The measured values of the $\Lambda_{\rm c}^+/{\rm D_0}$ ratio,which is sensitive to the c-quark hadronisation mechanism, and in particular tothe production of baryons, are presented and are larger than those measuredpreviously in different colliding systems, centre-of-mass energies, rapidityand $p_{\rm T}$ intervals, where the $\Lambda_{\rm c}^+$ production process maydiffer. The results are compared with the expectations obtained fromperturbative Quantum Chromodynamics calculations and Monte Carlo eventgenerators. Neither perturbative QCD calculations nor Monte Carlo modelsreproduce the data, indicating that the fragmentation of heavy-flavour baryonsis not well understood. The first measurement at the LHC of the $\Lambda_{\rmc}^+$ nuclear modification factor, $R_{\rm pPb}$, is also presented. The$R_{\rm pPb}$ is found to be consistent with unity and with that of D mesonswithin the uncertainties, and consistent with a theoretical calculation thatincludes cold nuclear matter effects and a calculation that includes charmquark interactions with a deconfined medium.