Is sharing R code for a dissertation consider to be plagiarism? I'm working on my individual dissertation in finance. This thesis tests the low-volatility factor on European markets. The core methodology is creating Fama and French portfolios, testing the new low-volatility factor with the Carhart model and a transaction costs analysis with R.

A friend of mine, who is also writing his thesis this semester, uses the same metrology to test the existence of a new momentum factor in the European markets. Therefore, we developed the core R code together. Although our dissertations are completely different, since we both test other factors, we do use the same code. Would you consider this plagiarism and how do I cope with this issue?
Plagiarism is copying someone else's result and presenting it as an own result. It doesn't seem you're planning to do that.

In general, there shouldn't be a problem to use a jointly developed software core for research in your and your friend's dissertation. Research is a lot about collaboration, so I'd view that rather positively. But it will be important that you distinguish results that were obtained jointly from individual results, and that you agree on that beforehand to avoid potentially difficult discussions down the road. Things to clarify would include:


In how much detail do your dissertations need to describe the jointly developed core, and how much overlap is acceptable there? That is something you need to discuss with your advisor as well. It may be problematic to include a substantial amount of jointly written text in the individual dissertations.
Is there potential for a joint paper that you publish independently of your theses to describe the core software? In your dissertations, you can then simply refer to that paper and avoid overlapping text there.
Can you agree on specific contributions that everybody made to the software, have each of you focus on that for his dissertation, and refer to the friend's dissertation for the other part?