[R-pkg-devel] New CRAN package assistance

2018-02-07 Thread Huw Campbell
Hey all,

I have just submitted a package for CRAN which works on my Mac and linux
boxes, but there are notes for Windows and my license file. There is little
indication as to what the actual problems are.

The library is a simple binding for the snappy compression library. I have
been rather meticulous, using sound property based testing (through my port
of the hedgehog  library) and
appropriate R data structures

Package source is here
https://github.com/HuwCampbell/snappier

and the CRAN check results are here
https://win-builder.r-project.org/incoming_pretest/180207_112224_snappier_0010/00check.log

Any help would be appreciated in solving these two issues (a third issue
regarding R versions I think can be resolved by removing the specified
version bound on R).

Cheers,
Huw

[[alternative HTML version deleted]]

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


[R-pkg-devel] Hedgehog property based testing

2018-02-09 Thread Huw Campbell
Hi all,

I have ported hedgehog, a property based testing library
 from Haskell to R, and would
really like folks to use it and test the API hard before I release it on
CRAN. I have been using it with great success for my projects for a while;
and have also uncovered a few real bugs in R libraries in the wild.

Hedgehog is similar to *quickcheck* in philosophy and fully compatible with
Hadley Wickham's *testthat* library, so should be easy to integrate. The
idea is to write property tests like this:

test_that("Reverse of reverse is identity",
  forall(gen.c(gen.element(1:100)), function(xs) expect_equal(rev(rev(xs)), xs))
)

Give it a shot and please do hit me up with any questions.

For all that I like about R, I think it can be tough to write robust
code which handles all the edge
cases one could throw at it, so great testing is invaluable.

Cheers,
Huw

[[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] CRAN write to home policy

2018-03-26 Thread Huw Campbell
Probably don't attempt to overwrite or change a user's chosen filenames.

I would probably still use tempfile(), but set either the pattern (which
gives a prefix)
or fileext for a chosen extension.



On Tue, Mar 27, 2018 at 10:07 AM, Ogan Mancarci 
wrote:

> Corrected antiSocialSkip6Lines
>
> antiSocialSkip6Lines = function(filename, output = paste0(filename,
> '_skipped')){
> lines = readLines(filename)
> lines = lines[-(1:6)]
> writeLines(lines, output)
> }
>
> On 26 March 2018 at 16:06, Ogan Mancarci  wrote:
>
> > Thanks for the clarification.
> >
> > What about a scenario where the user has enter a filename which is used
> as
> > a seed for the output file. For instance
> >
> > antiSocialSkip6Lines = function(filename, output = paste0(filename,
> > '_skipped')){
> > lines = readLines(filename)
> > lines = lines[-(1:6)]
> > }
> >
> > Here, there is an input from the user which determines what the output is
> > and it is clearly spelled out in the argument list. Yet the user input is
> > not the name of the resulting file unless the user wants it to be.
> >
> > Cheers,
> > Ogan
> >
> > On 26 March 2018 at 15:29, Uwe Ligges 
> > wrote:
> >
> >>
> >>
> >> On 26.03.2018 23:48, Ogan Mancarci wrote:
> >>
> >>> This is from  CRAN repository policy:
> >>>
> >>> "Packages should not write in the user’s home filespace (including
> >>> clipboards), nor anywhere else on the file system apart from the R
> >>> session’s temporary directory (or during installation in the location
> >>> pointed to by TMPDIR: and such usage should be cleaned up). (…) Limited
> >>> exceptions may be allowed in interactive sessions if the package
> obtains
> >>> confirmation from the user."
> >>>
> >>> I am unclear about the scope of this rule. For instance if I had this
> >>> function:
> >>>
> >>> antiSocialWriteLines = function(text, file = 'defaultFile', ...){
> >>>  writeLines(text , file, ...)
> >>> }
> >>>
> >>>
> >>
> >> Simply use file=tempfile() as the default so you do not overwrite stuff
> >> in the user filespace and the user can insert another filename which is
> the
> >> confirmation.
> >>
> >> Best,
> >> Uwe Ligges
> >>
> >>
> >>
> >> would I be allowed to add it to a package since it writes to a file by
> >>> default without asking for confirmation?
> >>>
> >>> Frankly reading this text, I feel like even writeLines itself violates
> it
> >>> as it writes without "confirmation" once you give it a file path.
> >>>
> >>> [[alternative HTML version deleted]]
> >>>
> >>> __
> >>> R-package-devel@r-project.org mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >>>
> >>>
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

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