Re: [R] Building Packages.

2024-03-20 Thread Ivan Krylov via R-help
В Wed, 20 Mar 2024 19:26:53 +
Jorgen Harmse  пишет:

> Thank you. tools:::.install_packages works.

I'm glad it works, but it shouldn't be necessary to use (and is not
part of the API: not documented to keep working this way).

Since you're already using devtools, perhaps devtools::install will
succeed. But it's not obvious why utils::install.packages() is failing,
and it should still be called by devtools::install().

> It happens that one of the functions in my package is a utility to
> build packages. I guess I should change the install step.

Try setting a breakpoint in system2 before launching your function:

debugonce(system2)
build.package('/path/to/the/source/tree')

This should land you in R's "browser" (see help(browser) for how to use
it). At this point, what is `command` and what are the `args`? If you
remove c("CMD", "INSTALL") from the `args` vector and give the rest as
the argument to .install_packages() in a fresh process, will it break
in a similar manner?

Browse[2]> command
[1] "/usr/lib/R/bin/R"
Browse[2]> args
[1] "CMD" "INSTALL" "-l"
"'/home/ivan/R/x86_64-pc-linux-gnu-library/4.2'"
"'/home/ivan/path/to/package_1.0.tar.gz'"

# (start a new process)

tools:::.install_packages(c(
 '-l',
 # you'll have to manually unquote the file paths:
 # the strings above are for both R and the command line shell
 # to interpret, but here we're only giving them to R, not the shell
 "/home/ivan/R/x86_64-pc-linux-gnu-library/4.2",
 "/home/ivan/path/to/package_1.0.tar.gz"
))

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Jorgen Harmse via R-help
Thank you. tools:::.install_packages works.

It happens that one of the functions in my package is a utility to build 
packages. I guess I should change the install step.

Regards,
Jorgen.



#' Build package from source

#'

#' \code{roxygen2} & \code{devtools} have several steps to build a package, and

#' \code{build.package} wraps them in one function. It can also clean up

#' and protect the description file.

#'

#' @param package.dir the directory with the package files arranged as expected 
by

#' \code{roxygen2} except as noted below

#' @param clean whether to remove old \code{Rd} files before starting

#' @param install whether to install the package after building it, which may 
make the latest

#' version available in the current R session

#'

#' @note The description file should be in \code{DESC.source} rather than 
\code{DESCRIPTION}.

#' \code{build.package} will then overwrite the machine-generated 
\code{DESCRIPTION} from the

#' previous build with the true source.

#'

#' @return \code{invisible()}

#'

#' @export



build.package <- function(package.dir,clean=TRUE,install=TRUE)

{ if (!require(roxygen2))

stop("Please install roxygen2 and its dependencies.")

  if (!require(devtools))

stop("Please install devtools and its dependencies.")

  if ( file.exists(file.path(package.dir,"DESC.source") -> DESC.source) )

file.copy(DESC.source, file.path(package.dir,"DESCRIPTION"), overwrite=TRUE)

  roxygenise(package.dir,clean=clean)

  tar <- devtools::build(package.dir)

  if (install)

install.packages(tar,type='source',repos=NULL)

  invisible()

}



From: Ivan Krylov 
Date: Wednesday, March 20, 2024 at 14:12
To: Jorgen Harmse 
Cc: Jorgen Harmse via R-help 
Subject: [EXTERNAL] Re: [R] Building Packages.
� Wed, 20 Mar 2024 17:00:34 +
Jorgen Harmse  �:

> Thank you, but I think I was already using utils.
>
> Regards,
> Jorgen.
>
>
> > environment(install.packages)
>
> 
>
> > utils::install.packages('/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz',type='source',repos=NULL)
> >
>
> Error in library(jhBase) : there is no package called �jhBase�

Sorry, then it has been my mistake to blame RStudio for this.

We can try debugging this. If you start a fresh R process and run
tools:::.install_packages(path_to_tarball), the installation will (try
to) proceed in the current process instead of a child process. Once it
fails, traceback() will be available to show you where the error
condition has been raised. What does it say?

Alternatively,

1. Check the package R files for stray library() calls. Generally,
packages should not be calling library().

2. Try a "binary search" approach. Make a copy of your package code but
remove half of the files (or half of the functions if they live in a
single file). Keep removing a half (or go to the other half) depending
on whether the same error keeps happening.

Good luck!

--
Best regards,
Ivan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Ivan Krylov via R-help
В Wed, 20 Mar 2024 17:00:34 +
Jorgen Harmse  пишет:

> Thank you, but I think I was already using utils.
> 
> Regards,
> Jorgen.
> 
> 
> > environment(install.packages)  
> 
> 
> 
> > utils::install.packages('/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz',type='source',repos=NULL)
> >  
> 
> Error in library(jhBase) : there is no package called ‘jhBase’

Sorry, then it has been my mistake to blame RStudio for this.

We can try debugging this. If you start a fresh R process and run
tools:::.install_packages(path_to_tarball), the installation will (try
to) proceed in the current process instead of a child process. Once it
fails, traceback() will be available to show you where the error
condition has been raised. What does it say?

Alternatively,

1. Check the package R files for stray library() calls. Generally,
packages should not be calling library().

2. Try a "binary search" approach. Make a copy of your package code but
remove half of the files (or half of the functions if they live in a
single file). Keep removing a half (or go to the other half) depending
on whether the same error keeps happening.

Good luck!

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Jorgen Harmse via R-help
I was thinking of making it Open Source, but I haven’t yet. It’s mostly a 
collection of small utility functions (more oxygen comments than actual code). 
I built the package on my Windows machine a few months ago, but my Mac first 
wouldn’t install roygen2 & devtools and now (with the latest version of R) 
won’t install the tarball that they create. (A work-around that I might try 
again is to build the package under Windows and ship the tarball to my Mac.)

Regards,
Jorgen.

Example:

#' Adjust number of columns used in printing

#'

#' Use \code{\link{options}} to determine the current number of columns, 
increment

#' or decrement, and pass the result as \code{width} in a second call to 
\code{options}.

#'

#' @param dw signed amount by which to increment the number of columns

#'

#' @return a list with the old value of \code{options('width')}

#'

#' @export



width <- function(dw) options(width = options('width')[[1L]] + as.integer(dw))


From: Duncan Murdoch 
Date: Wednesday, March 20, 2024 at 12:09
To: Jorgen Harmse , Ivan Krylov , Jorgen 
Harmse via R-help 
Subject: [EXTERNAL] Re: [R] Building Packages.
Is the source for your package online somewhere?

Duncan Murdoch

On 20/03/2024 1:00 p.m., Jorgen Harmse via R-help wrote:
> Thank you, but I think I was already using utils.
>
> Regards,
> Jorgen.
>
>
>> environment(install.packages)
>
> 
>
>> utils::install.packages('/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz',type='source',repos=NULL)
>
> Error in library(jhBase) : there is no package called �jhBase�
>
> Execution halted
>
> Warning in 
> utils::install.packages("/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz",
>   :
>
>installation of package 
> �/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz� 
> had non-zero exit status
>
>
> From: Ivan Krylov 
> Date: Wednesday, March 20, 2024 at 11:14
> To: Jorgen Harmse via R-help 
> Cc: Jorgen Harmse 
> Subject: [EXTERNAL] Re: [R] Building Packages.
> � Wed, 20 Mar 2024 16:02:27 +
> Jorgen Harmse via R-help  �:
>
>>> install.packages(tar,type='source',repos=NULL)
>>
>> Error in library(jhBase) : there is no package called �jhBase�
>>
>> Execution halted
>>
>> Warning in install.packages(tar, type = "source", repos = NULL) :
>>
>>installation of package
>> �/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz�
>> had non-zero exit status
>
> Using RStudio? It happens to override install.packages with a function
> that doesn't quite handle file paths. Try utils::install.packages(tar,
> type = "source", repos = NULL).
>
> --
> Best regards,
> Ivan
>
>[[alternative HTML version deleted]]
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] geom_edge & color

2024-03-20 Thread SIBYLLE STÖCKLI via R-help
Dear community

I am using ggraph to plot a network analysis. See part 2 in the working
example.
Besides different colors for different groups of nodes:
--> geom_node_point(aes(size = V(network)$hub_score*200, color=
as.factor(V(network)$community)))
I additionally want to consider different colors for different edge groups
The grouping is defined in the edge_list$relationship: negative relationship
= red and positive relationship = darkblue. The code is working in the way
that the  groups are separated by two colors. However, the code uses not the
assigned colors. Does anyone have any idea how to adapt the code?
--> geom_edge_arc(curvature=0.3, aes(width=(E(network)$weight/10),
color=c("darkblue", "red")[as.factor(edge_list$relationship)], alpha=0.5)) +

Kind regards
Sibylle




Working example

library(circlize)
library(ggplot2)
library(igraph)
library(tidyverse)
library(RColorBrewer)
library(stringi)
library(scico)
library(plotly)
library(ggraph)

edges_table_Test.csv

Names   target  weight relationship
B.B A.A 4   pos
C.C A.A 5   pos
D.D A.A 5   neg
E.E A.A 5  neg
F.F A.A 1  pos
C.C B.B 5 pos
E.E B.B 1   pos
F.F B.B 2  pos
A.A C.C 5pos
B.B C.C 1pos
D.D C.C 5 pos
E.E C.C 5 pos
F.F C.C 3 pos
A.A D.D 5neg
B.B D.D 1neg
C.C D.D 5neg
E.E D.D 5neg
F.F D.D 4 neg
A.A E.E 5 neg
B.B E.E 1neg
C.C E.E 4neg
D.D E.E 5neg
F.F E.E 5   pos
A.A F.F 5pos
B.B F.F 1   pos
C.C F.F 2   pos
D.D F.F 3  pos
E.E F.F 4   pos
F.F F.F 5   pos

edge_list<-read.csv("edges_table_Test.csv")

network <- graph_from_data_frame(aes_collapsed, directed= FALSE,
 vertices = details)

temp<-cluster_optimal(network)
temp<-cbind(membership=temp$membership, Names=temp$name) aes_collapsed <-
aes_collapsed %>%
  merge(temp, by="Names")


network <- network %>%
  set_edge_attr(name = "type", value = factor(aes_collapsed$Names,
 ordered =
is.ordered(V(network)$name))) %>%
  set_edge_attr(name = "membership", value = aes_collapsed$membership) %>%
  set_edge_attr(name = "color",
  value = c(viridis::viridis(5))
  [match(E(.)$type, c(factor(V(.)$name)))]) %>%
  set_vertex_attr(name = "trans_v_net", value = c(transitivity(., type =
"local"))) %>%
  set_vertex_attr(name = "hub_score", value = c(hub_score(.)$vector)) %>%
  set_vertex_attr(name = "color",
  value = c(viridis::viridis((5)))
  [match(V(.)$name, c(factor(V(.)$name)))]) %>%
  set_vertex_attr(name= "community", value=cluster_optimal(.)$membership)
clrs<-scico(3, palette = "batlow")

### part 1: network plot
par(bg="black")
network %>% plot(
 vertex.color=clrs[V(.)$community],
 vertex.size=V(.)$hub_score*5,
 vertex.frame.color=V(.)$color,
 vertex.label.color="white",
 vertex.label.cex=0.5,
 vertex.label.family="Helvetica",
 vertex.label.font=1,
 edge.curved=0.5,
 edge.width= network,
 layout=layout_with_mds(.))

### part 2: ggraph
tiff("figures/AES_network_bymembership.tiff", width=1000, height=700,
res=120) network %>%
  ggraph(., layout = "auto")+
geom_edge_arc(curvature=0.3, aes(width=(E(network)$weight/10),
color=c("darkblue", "red")[as.factor(edge_list$relationship)], alpha=0.5)) +

  geom_node_point(aes(size = V(network)$hub_score*200, color=
as.factor(V(network)$community))) +
  geom_node_text(aes(label =  V(network)$name), size=5, color="white",
repel=T)+
  scale_color_scico_d(palette = "batlow")+
  scale_edge_width(range = c(0.2,4))+
  scale_size(range = c(0.5,20)) +
  #scale_edge_color_manual(values = c(scico(21, palette="batlow")))+
  theme(plot.background = element_rect(fill = "black"),
legend.position = "right",
panel.background = element_rect(fill = "black"))
dev.off()

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Ben Bolker
  Hmm, looks platform-specific.  Under Linux both RStudio and external 
R console return


a0b52513622c41c11e3ef57c7a485767

for digest::digest(install.packages)

On 2024-03-20 1:20 p.m., Duncan Murdoch wrote:

On 20/03/2024 1:07 p.m., Duncan Murdoch wrote:

On 20/03/2024 12:37 p.m., Ben Bolker wrote:

 Ivan, can you give more detail on this? I've heard this issue
mentioned, but when I open RStudio and run find("install.packages") it
returns "utils::install.packages", and running dump() from within
RStudio console and from an external "R --vanilla" gives identical 
results.


 I thought at one point this might only refer to the GUI
package-installation interface, but you seem to be saying it's the
install.packages() function as well.

 Running an up-to-date RStudio on Linux, FWIW -- maybe weirdness 
only

happens on other OSs?


On MacOS, I see this:

  > install.packages
function (...)
.rs.callAs(name, hook, original, ...)


I get the same results as you from find().  I'm not sure what RStudio is
doing to give a different value for the function than what find() sees.


Turns out that RStudio replaces the install.packages object in the utils 
package.


Duncan Murdoch



Duncan Murdoch



  Ben Bolker

On 2024-03-20 12:13 p.m., Ivan Krylov via R-help wrote:

В Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  пишет:


install.packages(tar,type='source',repos=NULL)


Error in library(jhBase) : there is no package called ‘jhBase’

Execution halted

Warning in install.packages(tar, type = "source", repos = NULL) :

 installation of package
‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz’
had non-zero exit status


Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.






__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Ivan Krylov via R-help
В Wed, 20 Mar 2024 12:37:39 -0400
Ben Bolker  пишет:

> Ivan, can you give more detail on this? I've heard this issue 
> mentioned, but when I open RStudio and run find("install.packages")
> it returns "utils::install.packages", and running dump() from within 
> RStudio console and from an external "R --vanilla" gives identical
> results.

Has this been fixed in a recent RStudio version? This is what I get on
a Windows virtual machine:

> install.packages
function (...) 
.rs.callAs(name, hook, original, ...)

> install.packages(file.choose())
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘C:\path\to\mypackage_1.0.tar.gz’ is not available
for this version of R

A version of this package for your version of R might be available
elsewhere, see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
> utils::install.packages(file.choose())
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from 'pkgs'
* installing *source* package 'mypackage' ...
** using staged installation
** libs

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Duncan Murdoch

On 20/03/2024 1:07 p.m., Duncan Murdoch wrote:

On 20/03/2024 12:37 p.m., Ben Bolker wrote:

 Ivan, can you give more detail on this? I've heard this issue
mentioned, but when I open RStudio and run find("install.packages") it
returns "utils::install.packages", and running dump() from within
RStudio console and from an external "R --vanilla" gives identical results.

 I thought at one point this might only refer to the GUI
package-installation interface, but you seem to be saying it's the
install.packages() function as well.

 Running an up-to-date RStudio on Linux, FWIW -- maybe weirdness only
happens on other OSs?


On MacOS, I see this:

  > install.packages
function (...)
.rs.callAs(name, hook, original, ...)


I get the same results as you from find().  I'm not sure what RStudio is
doing to give a different value for the function than what find() sees.


Turns out that RStudio replaces the install.packages object in the utils 
package.


Duncan Murdoch



Duncan Murdoch



  Ben Bolker

On 2024-03-20 12:13 p.m., Ivan Krylov via R-help wrote:

В Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  пишет:


install.packages(tar,type='source',repos=NULL)


Error in library(jhBase) : there is no package called ‘jhBase’

Execution halted

Warning in install.packages(tar, type = "source", repos = NULL) :

 installation of package
‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz’
had non-zero exit status


Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Duncan Murdoch

Is the source for your package online somewhere?

Duncan Murdoch

On 20/03/2024 1:00 p.m., Jorgen Harmse via R-help wrote:

Thank you, but I think I was already using utils.

Regards,
Jorgen.



environment(install.packages)





utils::install.packages('/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz',type='source',repos=NULL)


Error in library(jhBase) : there is no package called �jhBase�

Execution halted

Warning in 
utils::install.packages("/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz",
  :

   installation of package 
�/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz� had 
non-zero exit status


From: Ivan Krylov 
Date: Wednesday, March 20, 2024 at 11:14
To: Jorgen Harmse via R-help 
Cc: Jorgen Harmse 
Subject: [EXTERNAL] Re: [R] Building Packages.
� Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  �:


install.packages(tar,type='source',repos=NULL)


Error in library(jhBase) : there is no package called �jhBase�

Execution halted

Warning in install.packages(tar, type = "source", repos = NULL) :

   installation of package
�/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz�
had non-zero exit status


Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).

--
Best regards,
Ivan

[[alternative HTML version deleted]]


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Duncan Murdoch

On 20/03/2024 12:37 p.m., Ben Bolker wrote:

Ivan, can you give more detail on this? I've heard this issue
mentioned, but when I open RStudio and run find("install.packages") it
returns "utils::install.packages", and running dump() from within
RStudio console and from an external "R --vanilla" gives identical results.

I thought at one point this might only refer to the GUI
package-installation interface, but you seem to be saying it's the
install.packages() function as well.

Running an up-to-date RStudio on Linux, FWIW -- maybe weirdness only
happens on other OSs?


On MacOS, I see this:

> install.packages
function (...)
.rs.callAs(name, hook, original, ...)


I get the same results as you from find().  I'm not sure what RStudio is 
doing to give a different value for the function than what find() sees.


Duncan Murdoch



 Ben Bolker

On 2024-03-20 12:13 p.m., Ivan Krylov via R-help wrote:

В Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  пишет:


install.packages(tar,type='source',repos=NULL)


Error in library(jhBase) : there is no package called ‘jhBase’

Execution halted

Warning in install.packages(tar, type = "source", repos = NULL) :

installation of package
‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz’
had non-zero exit status


Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Jorgen Harmse via R-help
Thank you, but I think I was already using utils.

Regards,
Jorgen.


> environment(install.packages)



> utils::install.packages('/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz',type='source',repos=NULL)

Error in library(jhBase) : there is no package called �jhBase�

Execution halted

Warning in 
utils::install.packages("/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz",
  :

  installation of package 
�/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz� had 
non-zero exit status


From: Ivan Krylov 
Date: Wednesday, March 20, 2024 at 11:14
To: Jorgen Harmse via R-help 
Cc: Jorgen Harmse 
Subject: [EXTERNAL] Re: [R] Building Packages.
� Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  �:

> > install.packages(tar,type='source',repos=NULL)
>
> Error in library(jhBase) : there is no package called �jhBase�
>
> Execution halted
>
> Warning in install.packages(tar, type = "source", repos = NULL) :
>
>   installation of package
> �/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz�
> had non-zero exit status

Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).

--
Best regards,
Ivan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Ben Bolker
  Ivan, can you give more detail on this? I've heard this issue 
mentioned, but when I open RStudio and run find("install.packages") it 
returns "utils::install.packages", and running dump() from within 
RStudio console and from an external "R --vanilla" gives identical results.


  I thought at one point this might only refer to the GUI 
package-installation interface, but you seem to be saying it's the 
install.packages() function as well.


  Running an up-to-date RStudio on Linux, FWIW -- maybe weirdness only 
happens on other OSs?


   Ben Bolker

On 2024-03-20 12:13 p.m., Ivan Krylov via R-help wrote:

В Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  пишет:


install.packages(tar,type='source',repos=NULL)


Error in library(jhBase) : there is no package called ‘jhBase’

Execution halted

Warning in install.packages(tar, type = "source", repos = NULL) :

   installation of package
‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz’
had non-zero exit status


Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building Packages.

2024-03-20 Thread Ivan Krylov via R-help
В Wed, 20 Mar 2024 16:02:27 +
Jorgen Harmse via R-help  пишет:

> > install.packages(tar,type='source',repos=NULL)  
> 
> Error in library(jhBase) : there is no package called ‘jhBase’
> 
> Execution halted
> 
> Warning in install.packages(tar, type = "source", repos = NULL) :
> 
>   installation of package
> ‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz’
> had non-zero exit status

Using RStudio? It happens to override install.packages with a function
that doesn't quite handle file paths. Try utils::install.packages(tar,
type = "source", repos = NULL).

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Building Packages.

2024-03-20 Thread Jorgen Harmse via R-help
I have a source file with oxygen-style comments (and description & licence 
files), and I’m trying to build a package. oxygen & devtools seem to work, and 
the tarball exists, but install.packages balks. Does anyone know what’s 
happening?

Regards,
Jorgen Harmse.


> roxygenise(package.dir,clean=TRUE)

Setting `RoxygenNote` to "7.3.1"

✖ roxygen2 requires "Encoding: UTF-8"

ℹ Current encoding is NA

ℹ Loading jhBase

Warning: ── Conflicts 
──
 jhBase conflicts

──

✖ `andNotNA` masks `jhBase::andNotNA()`.

✖ `array.named` masks `jhBase::array.named()`.

✖ `arrayInd.inv` masks `jhBase::arrayInd.inv()`.

  … and more.

ℹ Did you accidentally source a file rather than using `load_all()`?

  Run `rm(list = c("andNotNA", "array.named", "arrayInd.inv", 
"as.POSIXct_orig", "build.package", "colon", "file.info", "file.path", 
"files.removeDup", "fprintf", "grepi", "grepiv", "grepv", "grepvi", "ifelses", 
"index", "load.env", "load.list", "matrix.sq", "merges", "mm", "orNA", 
"pattern.NA", "plots", "printf",

  "save.env", "subs", "symmDiff", "vector.named", "width"))` to remove the 
conflicts.

Writing NAMESPACE

Writing printf.Rd

Writing width.Rd

Writing pattern.NA.Rd

Writing ddply.ns.Rd

Writing as.POSIXct_orig.Rd

Writing mm.Rd

Writing orNA.Rd

Writing merges.Rd

Writing index.Rd

Writing save.env.Rd

Writing build.package.Rd

Writing plots.Rd

Writing ifelses.Rd

Writing subs.Rd

Writing array.named.Rd

Writing grepv.Rd

Writing symmDiff.Rd

Writing file.info.Rd

Writing file.path.Rd

Writing files.removeDup.Rd

Writing arrayInd.inv.Rd

> tar <- devtools::build(package.dir)

── R CMD build 


✔  checking for file 
‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase/DESCRIPTION’ ...

─  preparing ‘jhBase’:

✔  checking DESCRIPTION meta-information ...

─  checking for LF line-endings in source and make files and shell scripts

─  checking for empty or unneeded directories

─  building ‘jhBase_1.0.1.tar.gz’



> file.info(tar)

  size 
isdir mode   mtime   ctime   atime uid gid  
 uname grname

/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz 14030 
FALSE  644 2024-03-20 10:49:10 2024-03-20 10:49:10 2024-03-20 10:49:10 503  20 
jharmse  staff

> install.packages(tar,type='source',repos=NULL)

Error in library(jhBase) : there is no package called ‘jhBase’

Execution halted

Warning in install.packages(tar, type = "source", repos = NULL) :

  installation of package 
‘/Users/jharmse/Library/CloudStorage/OneDrive-RokuInc/jhBase_1.0.1.tar.gz’ had 
non-zero exit status


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[ESS] Where does ESS saves ESSR environment information

2024-03-20 Thread Iago Giné Vázquez via ESS-help
Hi all,

I have included a line such as the following in my .emacs file:
(add-hook 'ess-r-post-run-hook (lambda () (ess-load-file "~/startR.r")))

I have restarted Emacs, tried to start R and get an error due to that R did not 
find the file.  I realized that I put ~ thinking in home path for Emacs, not 
home path for R, so I updated the path address to the correct one in my .emacs 
file:
(add-hook 'ess-r-post-run-hook (lambda () (ess-load-file 
"C:/Users/.../startR.r")))

Again, restarted Emacs, tried starting R..., but I got the same error, which 
through a traceback I get

 base::as.environment("ESSR")$.ess.source("~/startR.r", visibly = FALSE,
   output = TRUE)

So, at some point the address "~/startR.r" was saved, but I cannot find it. How 
may I remove it and update the ESS configuration?

Thank you for your help.

Best regards,
Iago

[[alternative HTML version deleted]]

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help