Re: [R-pkg-devel] Weird error message during R CMD Check

2018-03-13 Thread Duncan Murdoch

On 13/03/2018 4:53 PM, martiank...@gmail.com wrote:

Hello,

  


I'm trying to submit my package to CRAN but receiving the following error
message.

  


object 'connectionString' not found


Your example never defined a variable called connectionString, so you 
can't pass it to a function.


Duncan Murdoch



  


even if it is parameter of get_DB_info(connectionString) function - see the
function definition below error message.

  


Please, can you help me to understand what should be fixed in the code so
that I could successfully submit my package to CRAN?

  


Thanks a lot for any of your help in advance.

  


Best,

Martin

  


https://win-builder.r-project.org/incoming_pretest/180313_212715_RSQLS_16/00
check.log

* checking examples ...

** running examples for arch 'i386' ... ERROR

Running examples in 'RSQLS-Ex.R' failed

The error most likely occurred in:

  


base::assign(".ptime", proc.time(), pos = "CheckExEnv")



### Name: get_DB_info



### Title: Get database info



### Aliases: get_DB_info







### ** Examples







get_DB_info(connectionString)


Error in paste("", pathtocsvloader, " ", connectionString, " ", sql_task,  :


   object 'connectionString' not found

Calls: get_DB_info -> paste

Execution halted

** running examples for arch 'x64' ... ERROR

Running examples in 'RSQLS-Ex.R' failed

The error most likely occurred in:

  


base::assign(".ptime", proc.time(), pos = "CheckExEnv")



### Name: get_DB_info



### Title: Get database info



### Aliases: get_DB_info







### ** Examples







get_DB_info(connectionString)


Error in paste("", pathtocsvloader, " ", connectionString, " ", sql_task,  :


   object 'connectionString' not found

Calls: get_DB_info -> paste

Execution halted

* checking PDF version of manual ... OK

* DONE

Status: 2 ERRORs, 3 WARNINGs, 4 NOTEs

  


 get_DB_info(connectionString)


  


#' Get database info

#'

#' This function retrieves basic info about database defined

#' in SQL Server connection string.

#' @param connectionString Connection string to SQL server

#' @return Returns data.frame and data.table

#' @export

#' @examples

#' get_DB_info(connectionString)

#' @note How to set up SQL Server connection string see
\link{set_connString}. Be also sure you have a permissions for access to
sys.dm_db_index_usage_stats:

#' check it with SELECT * FROM sys.dm_db_index_usage_stats. If not, contact
your SQL Server admin.

get_DB_info <- function(connectionString) {

   options(scipen=999)

   if (missing(connectionString)) {

 print("Connection string is missing!")

 return("Try it again")

   }

   pathtocsvloader <- gsub("/","",paste(system.file(package =
"RSQLS")[1],"/Loader/csv_to_sql_loader.exe", sep = ""))

   pathtocsvloader <- replace_spaced_words(pathtocsvloader)

   pathtocsvloader <- gsub('.{1}$', '', pathtocsvloader)

   # logic for pathtocsvfiles variable

   pathtocsvfiles <- gsub("/","",paste(system.file(package =
"RSQLS")[1],"/Data/", sep = ""))

   if (!endsWith(pathtocsvfiles, "\\")) {

 pathtocsvfiles <- paste(pathtocsvfiles,"\\", sep = "")

   }

   sqltabname <- "tempDBInfo"

   sqltabname <- gsub("\\[|\\]", "", sqltabname)

   if (length(strsplit(sqltabname,"\\.")[[1]]) > 1) {

 sqltabname_prev <- gsub("^[^.]*.", "", sqltabname)

   } else {

 sqltabname_prev <- sqltabname

   }

   sql_tab_name <- paste('"', sqltabname, '"', sep = "") #
'"dbo.CFTC_Disaggregated_Raw_test"'

   sql_task <- paste('"dbinfo"', sep = "")

   real_pathtocsvfile <- paste('"', pathtocsvfiles, paste(sqltabname_prev,
".csv", sep = ""),'"', sep = "")

   file_to_be_deleted <- paste(pathtocsvfiles, paste(sqltabname_prev, ".csv",
sep = ""), sep = "")

   ss <- paste('', pathtocsvloader, " ", connectionString, " ", sql_task, "
", real_pathtocsvfile, " ", "null", sep = "")

   # Call shell command

   oldw <- getOption("warn")

   options(warn = -1)

   sc <- shell(ss)

   if (file.exists(file_to_be_deleted)){

 out <- data.table::fread(file_to_be_deleted, stringsAsFactors = FALSE,
sep = "~", fill = TRUE)

   } else{

 options(warn = oldw)

 stop('See the previous messages for more details.')

   }

   # Delete csv file

   if (file.exists(file_to_be_deleted)){

 invisible(file.remove(file_to_be_deleted))

   } else{

 options(warn = oldw)

 stop('See the previous messages for more details.')

   }

   if( sc == 1 ) {

 options(warn = oldw)

 stop('See the previous messages for more details.')

   } else {

 options(warn = oldw)

   }

   return(out)

}

  




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__

[R-pkg-devel] Weird error message during R CMD Check

2018-03-13 Thread martiankabe
Hello,

 

I'm trying to submit my package to CRAN but receiving the following error
message.

 

object 'connectionString' not found

 

even if it is parameter of get_DB_info(connectionString) function - see the
function definition below error message.

 

Please, can you help me to understand what should be fixed in the code so
that I could successfully submit my package to CRAN?

 

Thanks a lot for any of your help in advance.

 

Best,

Martin

 

https://win-builder.r-project.org/incoming_pretest/180313_212715_RSQLS_16/00
check.log

* checking examples ...

** running examples for arch 'i386' ... ERROR

Running examples in 'RSQLS-Ex.R' failed

The error most likely occurred in:

 

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")

> ### Name: get_DB_info

> ### Title: Get database info

> ### Aliases: get_DB_info

> 

> ### ** Examples

> 

> get_DB_info(connectionString)

Error in paste("", pathtocsvloader, " ", connectionString, " ", sql_task,  :


  object 'connectionString' not found

Calls: get_DB_info -> paste

Execution halted

** running examples for arch 'x64' ... ERROR

Running examples in 'RSQLS-Ex.R' failed

The error most likely occurred in:

 

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")

> ### Name: get_DB_info

> ### Title: Get database info

> ### Aliases: get_DB_info

> 

> ### ** Examples

> 

> get_DB_info(connectionString)

Error in paste("", pathtocsvloader, " ", connectionString, " ", sql_task,  :


  object 'connectionString' not found

Calls: get_DB_info -> paste

Execution halted

* checking PDF version of manual ... OK

* DONE

Status: 2 ERRORs, 3 WARNINGs, 4 NOTEs

 

 get_DB_info(connectionString)


 

#' Get database info

#'

#' This function retrieves basic info about database defined

#' in SQL Server connection string.

#' @param connectionString Connection string to SQL server

#' @return Returns data.frame and data.table

#' @export

#' @examples

#' get_DB_info(connectionString)

#' @note How to set up SQL Server connection string see
\link{set_connString}. Be also sure you have a permissions for access to
sys.dm_db_index_usage_stats:

#' check it with SELECT * FROM sys.dm_db_index_usage_stats. If not, contact
your SQL Server admin.

get_DB_info <- function(connectionString) {

  options(scipen=999)

  if (missing(connectionString)) {

print("Connection string is missing!")

return("Try it again")

  }

  pathtocsvloader <- gsub("/","",paste(system.file(package =
"RSQLS")[1],"/Loader/csv_to_sql_loader.exe", sep = ""))

  pathtocsvloader <- replace_spaced_words(pathtocsvloader)

  pathtocsvloader <- gsub('.{1}$', '', pathtocsvloader)

  # logic for pathtocsvfiles variable

  pathtocsvfiles <- gsub("/","",paste(system.file(package =
"RSQLS")[1],"/Data/", sep = ""))

  if (!endsWith(pathtocsvfiles, "\\")) {

pathtocsvfiles <- paste(pathtocsvfiles,"\\", sep = "")

  }

  sqltabname <- "tempDBInfo"

  sqltabname <- gsub("\\[|\\]", "", sqltabname)

  if (length(strsplit(sqltabname,"\\.")[[1]]) > 1) {

sqltabname_prev <- gsub("^[^.]*.", "", sqltabname)

  } else {

sqltabname_prev <- sqltabname

  }

  sql_tab_name <- paste('"', sqltabname, '"', sep = "") #
'"dbo.CFTC_Disaggregated_Raw_test"'

  sql_task <- paste('"dbinfo"', sep = "")

  real_pathtocsvfile <- paste('"', pathtocsvfiles, paste(sqltabname_prev,
".csv", sep = ""),'"', sep = "")

  file_to_be_deleted <- paste(pathtocsvfiles, paste(sqltabname_prev, ".csv",
sep = ""), sep = "")

  ss <- paste('', pathtocsvloader, " ", connectionString, " ", sql_task, "
", real_pathtocsvfile, " ", "null", sep = "")

  # Call shell command

  oldw <- getOption("warn")

  options(warn = -1)

  sc <- shell(ss)

  if (file.exists(file_to_be_deleted)){

out <- data.table::fread(file_to_be_deleted, stringsAsFactors = FALSE,
sep = "~", fill = TRUE)

  } else{

options(warn = oldw)

stop('See the previous messages for more details.')

  }

  # Delete csv file

  if (file.exists(file_to_be_deleted)){

invisible(file.remove(file_to_be_deleted))

  } else{

options(warn = oldw)

stop('See the previous messages for more details.')

  }

  if( sc == 1 ) {

options(warn = oldw)

stop('See the previous messages for more details.')

  } else {

options(warn = oldw)

  }

  return(out)

}

 



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] rgdal not available for checking

2018-03-13 Thread Alexandre Courtiol
Hi Pascal,
I would not worry about that.
This probably simply means that rgdal is not installed on the computer used
to check the package.
Since gdal is often somewhat difficult to install, I am not going to blame
CRAN.
++
Alex

On 13 March 2018 at 09:50, Pascal Title  wrote:

> Hi,
>
> I'm working on submitting an update to an existing R package to CRAN. I've
> tested it with R CMD check --as-cran and it passes with no errors, warnings
> or notes.
>
> But there is an error currently on the check results page for the current
> version, which you can see here:
> https://cran.r-project.org/web/checks/check_results_envirem.html
>
> The error is only for the r-release-osx-x86_64 platform, where the problem
> is "Package suggested but not available for checking: ‘rgdal’".
>
> I'm not sure what the problem is, as rgdal is a package on CRAN, and I
> can't seem to reproduce this problem on the different platforms that I have
> run R CMD check on, which as mac osx, ubuntu and win-builder. I imagine
> that the same problem will crop up with the updated version of the package.
>
> I've googled the error message, and it looks like there are many R packages
> with the same issue.
>
> Any suggestions for how to deal with this would be great. I could rewrite
> parts of my R package to avoid the use of rgdal in the examples, but that's
> working around the problem rather than addressing it.
>
> thanks!
> -Pascal
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



-- 
Alexandre Courtiol

http://sites.google.com/site/alexandrecourtiol/home

*"Science is the belief in the ignorance of experts"*, R. Feynman

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] rgdal not available for checking

2018-03-13 Thread Pascal Title
Hi,

I'm working on submitting an update to an existing R package to CRAN. I've
tested it with R CMD check --as-cran and it passes with no errors, warnings
or notes.

But there is an error currently on the check results page for the current
version, which you can see here:
https://cran.r-project.org/web/checks/check_results_envirem.html

The error is only for the r-release-osx-x86_64 platform, where the problem
is "Package suggested but not available for checking: ‘rgdal’".

I'm not sure what the problem is, as rgdal is a package on CRAN, and I
can't seem to reproduce this problem on the different platforms that I have
run R CMD check on, which as mac osx, ubuntu and win-builder. I imagine
that the same problem will crop up with the updated version of the package.

I've googled the error message, and it looks like there are many R packages
with the same issue.

Any suggestions for how to deal with this would be great. I could rewrite
parts of my R package to avoid the use of rgdal in the examples, but that's
working around the problem rather than addressing it.

thanks!
-Pascal

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Dealing with not so temporary files

2018-03-13 Thread Joris Meys
Duncan gave one option. The other option is to provide a specific
write2disk() function or so that allows the user to determine whether
he/she wants to save the data. Then the user can decide exactly where he
wants to find it.

The other important part is the format in which it's saved. Users can
simply use save() or write.csv() (or any of the readr functions if you
must) to store whatever data they want in the format they want. There's a
lot of database connections possible as well if that's needed. The only
reason I see to provide a specific write function or argument, is when the
storage is done in a nonstandard format. And then it makes sense to provide
both read_myformat() and write_myformat() in some form. That's what I as an
R user would expect.

Fwiw: I have seen the commotion on that discussion recently as well, but
this is really nothing new. For as long as I remember, writing to disk only
happens when you use a function that does explicitly that. Which makes
sense as well, as eg my students often run R in a shared environment during
classes, and sysadmins don't like software that starts writing files
everywhere.

Cheers
Joris



On Tue, Mar 13, 2018 at 12:32 AM, Duncan Murdoch 
wrote:

> On 12/03/2018 6:26 PM, Roy Mendelssohn - NOAA Federal wrote:
>
>> Hi All:
>>
>> Recently there was a proper admonishment to a developer that it is bad
>> etiquette writing to a user's home directory,  and for temporary files use
>> the functions tempdir() and tempfile().  I am working on a new package
>> (presently on Github) that downloads data from a remote server,  reads the
>> data into R,  but I would like to save that file for the user to access
>> later if they so desire.  Saving to the "temp directory" is not a good
>> option for that,  want to put it somewhere where the user can easily find
>> it.  What is the proper etiquette for this?  Even if I provide an argument
>> for the user to specify the location to save the file,  I should provide a
>> default location.
>>
>
> Why not provide an argument whose default is something given by tempfile()?
>
> Duncan Murdoch
>
>
>
>> Any suggestions appreciated.
>>
>> -Roy
>>
>>
>>
>>
>>
>> **
>> "The contents of this message do not reflect any position of the U.S.
>> Government or NOAA."
>> **
>> Roy Mendelssohn
>> Supervisory Operations Research Analyst
>> NOAA/NMFS
>> Environmental Research Division
>> Southwest Fisheries Science Center
>> ***Note new street address***
>> 110 McAllister Way
>> Santa Cruz, CA 95060
>> Phone: (831)-420-3666
>> Fax: (831) 420-3980
>> e-mail: roy.mendelss...@noaa.gov www: http://www.pfeg.noaa.gov/
>>
>> "Old age and treachery will overcome youth and skill."
>> "From those who have been given much, much will be expected"
>> "the arc of the moral universe is long, but it bends toward justice" -MLK
>> Jr.
>>
>> __
>> R-package-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



-- 
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)


tel: +32 (0)9 264 61 79
---
Biowiskundedagen 2017-2018
http://www.biowiskundedagen.ugent.be/

---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel