updated patent_analysis.R