Dear All,
I am trying to download GEO data using getGEO function. Below are the code and error message. I would appreciate if you could let me know whats going on with it. I already tried options('download.file.method'='curl') and it did not work. Thanks.
gse_retrieval<-function(Tumor_gse, GPLs)
{
    basedir=paste(getwd(),'processed_data',sep='/')
#########    1: Libraries########
library(GEOquery)
##########    2: Download Series Matrix and Raw data###########
for(j in 1:length(Tumor_gse))
{
    ######    3: Create GSE names directory########    
    gse_names= as.character(Tumor_gse[j])
    dir.create(gse_names)
    setwd(gse_names)
        #########    4: Series File Retrieval and GPL assignment ############
        series_file=getGEO(gse_names,GSEMatrix=T)
        number_series=1        #will be updated in block if there will be more then one series file
    #If there are more then one series matrix usually they have GPL name in their series matrix file name e.g. GSE19885_GPL96_series_matrix.txt.gz. So we can find our all required GPLs from the names but here in this case there is only one GPL. 
   ################################################################################################
source('GEO_retrieval.R')
source('qualityControl.R')
source('normalization_after_georetrieval.R')
source('pdataAdjustment.R')
gse_try1=c('GSE5586','GSE46844','GSE31712')
GPL='GPL1319'
#dir.create('processed_data')
gse_retrieval(gse_try1,GPL)
#############################################################################################
 Error in download.file(sprintf("ftp://ftp.ncbi.nlm.nih.gov/geo/series/%s/%s/matrix/%s",  : 
  cannot open URL 'ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE5nnn/GSE5586/matrix/GSE5586_series_matrix.txt.gz' 
##############################################################################################
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] GEOquery_2.34.0     Biobase_2.28.0      BiocGenerics_0.14.0
loaded via a namespace (and not attached):
[1] tools_3.2.2    RCurl_1.95-4.7 bitops_1.0-6   XML_3.98-1.3  

Make sure that you are not behind a firewall (where you would need to set a proxy). Otherwise, try again in a few hours.
I was able to download using a USB modem but I cant download connected to the internet my institute provides. That would mean I need to alter something in my connection right. Can you tell me how to bypass this using institutes internet ?
See the help for download.file(), and specifically the section on setting proxies. You may need to consult with your IT support folks to get the proxy correct:
http://stat.ethz.ch/R-manual/R-patched/library/utils/html/download.file.html