How to retrieve the subcellular location info from uniprot?
Since you are already on UniProtKB, the simplest way will be if you add this information to the output table and download it as a that you can import and filter in R.

To get additional annotations, click the button labelled "Columns" on top of the UniPortKB website. 

This allows you to add a wide variety of annotations such as subcellular location to the output. Tick the checkmark for subcellular location and save on the top right.

Then you can download the proteome-wide annotation for example as a tab-separated list using the "Download" dialog next to the "Columns" selection. This list can be imported into R.