Re: [Rd] Concordances in R Markdown

2022-11-28 Thread Duncan Murdoch

Two quick updates:

I will (probably) merge the Markdown support code into the patchDVI 
package (currently in the RmdConcord branch), instead of creating a new 
package.  So install instructions should be:


   devtools::install_github("dmurdoch/backports")
   devtools::install_github("dmurdoch/knitr")
   devtools::install_github("dmurdoch/patchDVI@RmdConcord")

I need to finish some integration with patchDVI and finalize my decision 
before merging that code into the main branch of patchDVI, but it's 
basically working now.


Secondly, with John Nash's help, I've identified some important 
limitations of the current Pandoc support.  Most importantly, Markdown 
citations (e.g. [@doe99]) are not handled.  Apparently this extension is 
being worked on, but there's no predicted completion date.  All the 
limitations that I know about are now documented in the patchDVI vignette.


Duncan Murdoch

On 26/11/2022 8:54 a.m., Duncan Murdoch wrote:

I submitted some code to support concordances to R-devel, and wrote this
blog article about it:

https://blog.r-project.org/2022/10/20/concordances/index.html

(Concordances are links from a source file to pre-processed output from
Sweave or knitr.)

In the article I said "as far as I know, Pandoc doesn’t support any way
to relate input lines to output lines", and asked to be corrected if
that was wrong.  I was corrected!  Heather Turner pointed me in the
direction of this:

   https://github.com/jgm/pandoc/issues/4565#issuecomment-749294039

She also worked out the initial details of how to make use of it.
Thanks Heather!

I have now put together a package called RmdConcord (see
https://github.com/dmurdoch/RmdConcord) which exports R Markdown drivers
that incorporate concordances.  This means that previewers like TeXworks
that support Synctex will now synchronize the output with the true
input, which makes editing a lot easier.  If you have complaints from
HTML Tidy about your vignettes, they should also refer to the original
source now.

The package requires changes to the knitr package to support
concordances in R Markdown documents, and to the backports package to
support the R-devel concordance additions in earlier versions of R.
I've submitted pull requests to both packages to include these changes,
but in the meantime, you will need to install my devel versions of them:

devtools::install_github("dmurdoch/backports")
devtools::install_github("dmurdoch/knitr")
devtools::install_github("dmurdoch/RmdConcord")

If anyone is interested in testing this, I'd appreciate bug reports and
suggestions.

Duncan Murdoch


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


[Rd] RTools40 Error - sh: line 1: gcc: command not found

2022-11-28 Thread Gene Leynes
Hello,

I installed git bash for windows, R, RStudio, and R Tools on a fresh
Windows 10 machine.

I followed the directions for RTools:
https://cran.r-project.org/bin/windows/Rtools/rtools40.html

I added RTools to my user path, but I was getting an error when
installing jsonlite from source (even though it could find "make"
correctly). So, I tried the .Renviron method, and that didn't work either.

I was getting errors like this:

> install.packages("jsonlite", type = "source")
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cloud.r-project.org/src/contrib/jsonlite_1.8.3.tar.gz'
Content type 'application/x-gzip' length 1053099 bytes (1.0 MB)
downloaded 1.0 MB


* installing *source* package 'jsonlite' ...
** package 'jsonlite' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/Users/XXX/AppData/Local/Programs/R/R-42~1.2/include"
-DNDEBUG -Iyajl/api
 -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"
-D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2
-mstackrealign  -c base64.c -o base64.o
sh: line 1: gcc: command not found
make: *** [C:/Users/ XXX
/AppData/Local/Programs/R/R-42~1.2/etc/x64/Makeconf:253:
base64.o] Error 127
ERROR: compilation failed for package 'jsonlite'
* removing
'C:/Users/375492/AppData/Local/Programs/R/R-4.2.2/library/jsonlite'


The downloaded source packages are in
‘C:\Users\ XXX
\AppData\Local\Temp\RtmpeCLXit\downloaded_packages’
Warning message:
In install.packages("jsonlite", type = "source") :
  installation of package ‘jsonlite’ had non-zero exit status


I can't reproduce this part, but at one point it said that gcc wasn't found
in C:\rtools40\mingw_64\bin (not sure where the underscore was, but it had
an underscore)

I noticed that my folder is named C:\rtools40\mingw64\bin

That gave me the idea to add C:\rtools40\mingw64\bin to my user path which
resolved the issues. Adding that to the path allowed me to compile from
source, etc. Fixed RStudio and the R GUI (whatever we call it now).

TLDR: I think there's a bug in the installer or something that creating an
incompatible path name with an underscore, or the instructions are missing
the advice to add C:\rtools40\mingw{WIN}\bin to the path.



Somewhat related:

By the way, I think adding RTools to the user path is the superior option
for Windows users, and I would like to propose an edit to that
documentation.

First, it will help avoid complications for users who may
experience different paths for ~ depending on network availability.

Second, it is a more standard way to edit the path and helps users learn
what's going on with the path and makes R less of a mysterious "exception
to the rule". No other program uses ~/.Renviron to edit the path.

Although it's worth mentioning the option to create ~/.Renviorn, it
shouldn't be the primary instruction.

Would it be possible to create a pull request for those edits? I don't know
where that documentation is maintained.


Thank you, and I hope you all are doing well.

[[alternative HTML version deleted]]

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


Re: [Rd] RTools40 Error - sh: line 1: gcc: command not found

2022-11-28 Thread Simon Urbanek
Gene,

I believe you have the wrong page - the link you listed is for an old version 
of R (4.0-4.1) - the current one (for 4.2.x) is

https://cran.r-project.org/bin/windows/Rtools/rtools42/rtools.html

Cheers,
Simon


> On 29/11/2022, at 7:39 AM, Gene Leynes  wrote:
> 
> Hello,
> 
> I installed git bash for windows, R, RStudio, and R Tools on a fresh
> Windows 10 machine.
> 
> I followed the directions for RTools:
> https://cran.r-project.org/bin/windows/Rtools/rtools40.html
> 
> I added RTools to my user path, but I was getting an error when
> installing jsonlite from source (even though it could find "make"
> correctly). So, I tried the .Renviron method, and that didn't work either.
> 
> I was getting errors like this:
> 
>> install.packages("jsonlite", type = "source")
> --- Please select a CRAN mirror for use in this session ---
> trying URL 'https://cloud.r-project.org/src/contrib/jsonlite_1.8.3.tar.gz'
> Content type 'application/x-gzip' length 1053099 bytes (1.0 MB)
> downloaded 1.0 MB
> 
> 
> * installing *source* package 'jsonlite' ...
> ** package 'jsonlite' successfully unpacked and MD5 sums checked
> ** using staged installation
> ** libs
> gcc  -I"C:/Users/XXX/AppData/Local/Programs/R/R-42~1.2/include"
> -DNDEBUG -Iyajl/api
> -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"
> -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2
> -mstackrealign  -c base64.c -o base64.o
> sh: line 1: gcc: command not found
> make: *** [C:/Users/ XXX
> /AppData/Local/Programs/R/R-42~1.2/etc/x64/Makeconf:253:
> base64.o] Error 127
> ERROR: compilation failed for package 'jsonlite'
> * removing
> 'C:/Users/375492/AppData/Local/Programs/R/R-4.2.2/library/jsonlite'
> 
> 
> The downloaded source packages are in
>‘C:\Users\ XXX
> \AppData\Local\Temp\RtmpeCLXit\downloaded_packages’
> Warning message:
> In install.packages("jsonlite", type = "source") :
>  installation of package ‘jsonlite’ had non-zero exit status
> 
> 
> I can't reproduce this part, but at one point it said that gcc wasn't found
> in C:\rtools40\mingw_64\bin (not sure where the underscore was, but it had
> an underscore)
> 
> I noticed that my folder is named C:\rtools40\mingw64\bin
> 
> That gave me the idea to add C:\rtools40\mingw64\bin to my user path which
> resolved the issues. Adding that to the path allowed me to compile from
> source, etc. Fixed RStudio and the R GUI (whatever we call it now).
> 
> TLDR: I think there's a bug in the installer or something that creating an
> incompatible path name with an underscore, or the instructions are missing
> the advice to add C:\rtools40\mingw{WIN}\bin to the path.
> 
> 
> 
> Somewhat related:
> 
> By the way, I think adding RTools to the user path is the superior option
> for Windows users, and I would like to propose an edit to that
> documentation.
> 
> First, it will help avoid complications for users who may
> experience different paths for ~ depending on network availability.
> 
> Second, it is a more standard way to edit the path and helps users learn
> what's going on with the path and makes R less of a mysterious "exception
> to the rule". No other program uses ~/.Renviron to edit the path.
> 
> Although it's worth mentioning the option to create ~/.Renviorn, it
> shouldn't be the primary instruction.
> 
> Would it be possible to create a pull request for those edits? I don't know
> where that documentation is maintained.
> 
> 
> Thank you, and I hope you all are doing well.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

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