How to retrieve the subcellular location info from uniprot? I have a list of proteins with their gene names/symbols. I would like to identify which of them are extracellular proteins or plasma membrane proteins. 

I can get this information in UniprotKB by searching the proteins one by one. Because I have hundreds of proteins, I wonder whether I can do a systematic search of the UniprotKB in RStudio. I tried the UniProt.ws select method. But I couldn't even get the example code in the package work. I downloaded the uniprot_sprot.dat file. But I don't know how to read this file correctly in RStudio. I used tab-delimited format. It turned out there is only one variable in the file. 

Can anybody tell me what I should do to solve the problem? I am pretty new to any computer languages.
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.