Re: [R] how to combine uncertainty and weighting in spearman correlation?

2020-06-22 Thread Abby Spurdle
Hi,

I suspect that there's a formula for this.
However, I couldn't find it.
So, here's (most of) the code to produce a simulated data set.

---
sim.data <- function (xmean, ymean, xsd=NULL, ysd=NULL, w, ...,
print=FALSE, plot=FALSE, nsub=1000)
{   N <- length (xmean)

x <- y <- u <- matrix (0, nsub, N)
for (k in 1:N)
{   if (is.null (xsd) ) x [,k] <- xmean [k]
else x [,k] <- rnorm (nsub, xmean [k], xsd [k])
if (is.null (ysd) ) y [,k] <- ymean [k]
else y [,k] <- rnorm (nsub, ymean [k], ysd [k])
u [,k] <- w [k] / nsub
}
x <- as.vector (x)
y <- as.vector (y)
u <- as.vector (u)

if (print)
print (cbind (x, y, u) )
if (plot)
{   plot (x, y)
points (xmean, ymean, pch=16, col="blue")
}

cor (x, y)
}
---

I didn't install the wCorr package, so you'll need to change the
second to last line.
The weights are in the vector, u (not w).

A subsample is generated for each group.
I've computed weights, such that the total weights for each group are
equal to the original weight for that group.
That sounds right, but I'm not completely sure.

Then call it using something like:
sim.data (x1, y1, x1_SD, NULL, corr_weight)

You can remove the print/plot parts if you want.
But if you call it with print=TRUE, then set nsub to a smaller value.
sim.data (x1, y1, x1_SD, NULL, corr_weight, print=TRUE, plot=TRUE, nsub=10)

If there's any problems, let me know.

On Mon, Jun 22, 2020 at 7:55 PM Frederik Feys  wrote:
>
> Thanks Abby, some info on the data:
>
> score   score_SDdeath_count population_size
> x1  x1_SD   y1  corr_weight
> 4.3 2.3 5800900.000
> 5.7 6.1 250 11.000.600
> ..  ..  ..  ..
>
> > Op 22 jun. 2020, om 02:02 heeft Abby Spurdle  het 
> > volgende geschreven:
> >
> > I need to fix my mistakes, from earlier this morning.
> > The sums should be over densities, so:
> >
> > fh (X, Y) = [fh1 (X1, X1) + fh2 (X2, Y2) + ... + fhn (Xn, Yn)] / n
> >
> > fh (X, Y) = w1*fh1 (X1, X1) + w2*fh2 (X2, Y2) + ... + wn*fhn (Xn, Yn)
> >
> >assuming the weights sum to 1
> >
> > If simulated data is used, then the expressions above can be replaced
> > with the union of multiple (sub)samples.
> > Then an estimate/inference (say correlation) can be computed from one
> > or more combined samples.
> >
> > Sorry, for triple posting.
> >
> >
> > On Mon, Jun 22, 2020 at 10:00 AM Abby Spurdle  wrote:
> >>
> >> Hi Frederick,
> >>
> >> I glanced at the webpage you've linked.
> >> (But only the top three snippets).
> >>
> >> This is what I would call the sum of random variables.
> >> (X, Y) = (X1, X1) + (X2, Y2) + ... + (Xn, Yn)
> >>
> >> The example makes the mistake of assuming that the Xs are normally
> >> distributed, and each of the Ys are from exactly the same uniform
> >> distribution.
> >> By "combine"-ing both approaches, are you wanting to weight each pair?
> >>
> >> w1(X1, X1) + w2(X2, Y2) + ... + wn(Xn, Yn)
> >>
> >> I note that you haven't told us much about your data.
> >> There may be an easier way of doing things...
> >>
> >>
> >> On Mon, Jun 22, 2020 at 1:53 AM Frederik Feys  wrote:
> >>>
> >>> Hello everyone
> >>>
> >>> At the moment I put a lot of attention in the uncertainty of my analyzes. 
> >>> I want to do a spearman correlation that takes into account the 
> >>> uncertainty in my observations and has weighting.
> >>>
> >>> uncertainty of observations: I came across this excellent blog that 
> >>> proposes a bootstrap function: 
> >>> https://www.r-bloggers.com/finding-correlations-in-data-with-uncertainty/
> >>>
> >>> weighted: I do weighted correlations with the wCorr package.
> >>>
> >>> Now I want to combine both approaches in one approach for a final 
> >>> analysis. How would you do that?
> >>>
> >>> Thanks for the help!
> >>>
> >>> Frederik Feys
> >>> PhD Medical Sciences
> >>> Onafhankelijk Methodoloog
> >>> https://www.researchgate.net/profile/Frederik_Feys
> >>> +32488020010
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>[[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] how to combine uncertainty and weighting in spearman correlation?

2020-06-22 Thread Frederik Feys
Thanks Abby, some info on the data:

score   score_SDdeath_count population_size
x1  x1_SD   y1  corr_weight 
4.3 2.3 5800900.000 
5.7 6.1 250 11.000.600
..  ..  ..  ..

> Op 22 jun. 2020, om 02:02 heeft Abby Spurdle  het 
> volgende geschreven:
> 
> I need to fix my mistakes, from earlier this morning.
> The sums should be over densities, so:
> 
> fh (X, Y) = [fh1 (X1, X1) + fh2 (X2, Y2) + ... + fhn (Xn, Yn)] / n
> 
> fh (X, Y) = w1*fh1 (X1, X1) + w2*fh2 (X2, Y2) + ... + wn*fhn (Xn, Yn)
> 
>assuming the weights sum to 1
> 
> If simulated data is used, then the expressions above can be replaced
> with the union of multiple (sub)samples.
> Then an estimate/inference (say correlation) can be computed from one
> or more combined samples.
> 
> Sorry, for triple posting.
> 
> 
> On Mon, Jun 22, 2020 at 10:00 AM Abby Spurdle  wrote:
>> 
>> Hi Frederick,
>> 
>> I glanced at the webpage you've linked.
>> (But only the top three snippets).
>> 
>> This is what I would call the sum of random variables.
>> (X, Y) = (X1, X1) + (X2, Y2) + ... + (Xn, Yn)
>> 
>> The example makes the mistake of assuming that the Xs are normally
>> distributed, and each of the Ys are from exactly the same uniform
>> distribution.
>> By "combine"-ing both approaches, are you wanting to weight each pair?
>> 
>> w1(X1, X1) + w2(X2, Y2) + ... + wn(Xn, Yn)
>> 
>> I note that you haven't told us much about your data.
>> There may be an easier way of doing things...
>> 
>> 
>> On Mon, Jun 22, 2020 at 1:53 AM Frederik Feys  wrote:
>>> 
>>> Hello everyone
>>> 
>>> At the moment I put a lot of attention in the uncertainty of my analyzes. I 
>>> want to do a spearman correlation that takes into account the uncertainty 
>>> in my observations and has weighting.
>>> 
>>> uncertainty of observations: I came across this excellent blog that 
>>> proposes a bootstrap function: 
>>> https://www.r-bloggers.com/finding-correlations-in-data-with-uncertainty/
>>> 
>>> weighted: I do weighted correlations with the wCorr package.
>>> 
>>> Now I want to combine both approaches in one approach for a final analysis. 
>>> How would you do that?
>>> 
>>> Thanks for the help!
>>> 
>>> Frederik Feys
>>> PhD Medical Sciences
>>> Onafhankelijk Methodoloog
>>> https://www.researchgate.net/profile/Frederik_Feys
>>> +32488020010
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>[[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] Error message in meta-analysis package Metafor-weights =""

2020-06-22 Thread K Amoatwi
Hi Wolfgang and All,
I am still practising my meta-analysis with the "Metafor" package, I tried
to run the code for "Forest plot" and got error message as shown below:
forest(result.md)
> forest(result.md)
Error in UseMethod("forest") :
  no applicable method for 'forest' applied to an object of class
"c('rma.uni', 'rma')"

Thank you in advance for your support

regards
Kobby


On Tue, Jun 16, 2020 at 12:50 PM Viechtbauer, Wolfgang (SP) <
wolfgang.viechtba...@maastrichtuniversity.nl> wrote:

> Dear Amoatwi,
>
> This way of using the escalc() function has been deprecated. It might be
> added back once there is actually any benefit from having this
> functionality, but for years it just meant that I had to maintain two
> different ways of doing the exact same thing without any additional
> benefits.
>
> Best,
> Wolfgang
>
> --
> Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and
>
> Neuropsychology | Maastricht University | P.O. Box 616 (VIJV1) | 6200 MD
>
> Maastricht, The Netherlands | +31 (43) 388-4170 | http://www.wvbauer.com
>
>
> >-Original Message-
> >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of K Amoatwi
> >Sent: Tuesday, 16 June, 2020 4:50
> >To: r-help@r-project.org
> >Subject: [R] Error message in meta-analysis package Metafor-weights =""
> >
> >Dear All,
> >I am using the example from one of the tutorial about "Metafor" package
> and
> >"escalc" function, to learn how this package can be applied to do
> >meta-analysi; the code and the data is directly from the tutorials but
> >"weights=freq" option in the escalc function is given me error message
> >This is the code below:
> >
> >library(metafor) # Load package
> >#DATASET 1: BCG Vaccine Trials
> >data(dat.bcg) # BCG meta-analytic dataset
> >
> >##Formula based Specification
> >##That is, what if I have multiple rows per study, corresponding to
> >difference treatment groups?
> >
> >library(reshape2) # Load package for data reshaping
> >
> >bcg.long <- melt(dat.bcg[, c("trial", "tpos", "tneg", "cpos", "cneg")], id
> >= "trial")
> >bcg.long$pos <- ifelse(bcg.long$var == "tpos" | bcg.long$var == "cpos", 1,
> >0)
> >bcg.long$group <- ifelse(bcg.long$var == "tpos" | bcg.long$var == "tneg",
> >1, 0)
> >
> >##sample of the data, the first 6 rows
> >head(bcg.long)
> >  trial variable value pos group
> >1 1 tpos 4 1 1
> >2 2 tpos 6 1 1
> >3 3 tpos 3 1 1
> >4 4 tpos621 1
> >5 5 tpos331 1
> >6 6 tpos   180   1 1
> >
> >##Now applying the " escalc " function
> >
> >escalc(factor(pos)~factor(group)| factor(trial),weights = value,data =
> >bcg.long, measure = "OR")
> >
> >##Then I got this error message
> >Error in escalc(factor(pos) ~ factor(group) | factor(trial), weights =
> >value,  :
> >  object 'value' not found
> >
> >I used the same data with different example from another author and got a
> >similar error message
> >Second code with the same data but different coding
> >Sample data
> >
> >with the first 6 rows of the rearranged data shown below. (T=treatment,
> >C=Control group, Out=outcome whether positive or negative, and then
> >frequency)
> >study grp out freq
> >11T+  4
> >21T-119
> >31C   +  11
> >41C   - 128
> >52T   +6
> >62T   -  300
> >
> >>escalc(out ~ grp | study, weights = freq, data = dat.fm, measure = "OR")
> >
> >Error in escalc(out ~ grp | study, weights = freq, data = dat.fm,
> measure =
> >"OR") :
> >  object 'freq' not found
> >
> >I am not sure what I am doing wrong since both authors were able to get
> >their results while I am getting error messages.
> >
> >Any help will be very much appreciated
> >
> >Amoatwi
>

[[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] How to loop over two files ...

2020-06-22 Thread Ana Marija
Thank you so much as.character(r) indeed resolved the issue!

On Sat, Jun 20, 2020 at 3:47 AM Ivan Krylov  wrote:
>
> On Fri, 19 Jun 2020 19:36:41 -0500
> Ana Marija  wrote:
>
> > Error in cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1),
> > "\n"),  : argument 1 (type 'list') cannot be handled by 'cat'
>
> It might be a good idea to try to solve problems like this yourself
> instead of waiting for hours for someone to reply. All the required
> information is there in the error message: write() fails because r is a
> list. Why is r a list? It's returned from GET(), so let's read its
> documentation.
>
> httr::GET() returns a response object, not a string [1]. Try passing
> as.character(r) or content(r,'text') instead of just r to write(...) or
> use a different way of extracting the actual response from the response
> object.
>
> --
> Best regards,
> Ivan
>
> [1] https://httr.r-lib.org/reference/GET.html

__
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] R 4.0.2 is released

2020-06-22 Thread Spencer Graves

Thank you and all the core R team.  Spencer Graves


On 2020-06-22 03:21, Peter Dalgaard via R-help wrote:

The build system rolled up R-4.0.2.tar.gz (codename "Taking Off Again") this 
morning.

The list below details the changes in this release.

You can get the source code from

http://cran.r-project.org/src/base/R-4/R-4.0.2.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 4afa171cd982aaa60f0ba92e2e7bc5d6
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 566a6bb3642e28e6bf01cf98db31137c
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 62496d3a0fd8cc2ed644ea518c052371
MD5 (R-4/R-4.0.2.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e

2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
eddf87b12197c7b3b19cbc9b11c1beab95b14e3dcd715bf37d2f6a8b2a72c2a1  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
ec05bba338358410fae6b34fed061605989ab3601aba1b3fcb45a610d5dd2eb9  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
10cc5f566a4a5ce49147e7dcfbe9180dba09ccb9efb17298b067309eb799e92e  
VERSION-INFO.dcf
d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75  
R-4/R-4.0.2.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.2:

   UTILITIES:

 * R CMD check skips vignette re-building (with a warning) if the
   VignetteBuilder package(s) are not available.

   BUG FIXES:

 * Paths with non-ASCII characters caused problems for package
   loading on Windows PR#17833.

 * Using tcltk widgets no longer crashes R on Windows.

 * source(*, echo=TRUE) no longer fails in some cases with empty
   lines; reported by Bill Dunlap in PR#17769.

 * on.exit() now correctly matches named arguments, thanks to
   PR#17815 (including patch) by Brodie Gaslam.

 * regexpr(*, perl=TRUE) no longer returns incorrect positions into
   text containing characters outside of the Unicode Basic
   Multilingual Plane on Windows.



__
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] R 4.0.2 is released

2020-06-22 Thread Peter Dalgaard via R-help
The build system rolled up R-4.0.2.tar.gz (codename "Taking Off Again") this 
morning.

The list below details the changes in this release.

You can get the source code from

http://cran.r-project.org/src/base/R-4/R-4.0.2.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 4afa171cd982aaa60f0ba92e2e7bc5d6
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 566a6bb3642e28e6bf01cf98db31137c
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 62496d3a0fd8cc2ed644ea518c052371
MD5 (R-4/R-4.0.2.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e

2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
eddf87b12197c7b3b19cbc9b11c1beab95b14e3dcd715bf37d2f6a8b2a72c2a1  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
ec05bba338358410fae6b34fed061605989ab3601aba1b3fcb45a610d5dd2eb9  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
10cc5f566a4a5ce49147e7dcfbe9180dba09ccb9efb17298b067309eb799e92e  
VERSION-INFO.dcf
d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75  
R-4/R-4.0.2.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.2:

  UTILITIES:

* R CMD check skips vignette re-building (with a warning) if the
  VignetteBuilder package(s) are not available.

  BUG FIXES:

* Paths with non-ASCII characters caused problems for package
  loading on Windows PR#17833.

* Using tcltk widgets no longer crashes R on Windows.

* source(*, echo=TRUE) no longer fails in some cases with empty
  lines; reported by Bill Dunlap in PR#17769.

* on.exit() now correctly matches named arguments, thanks to
  PR#17815 (including patch) by Brodie Gaslam.

* regexpr(*, perl=TRUE) no longer returns incorrect positions into
  text containing characters outside of the Unicode Basic
  Multilingual Plane on Windows.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
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] Load svg, eps or png into graphics device?

2020-06-22 Thread Rainer M Krug



> On 20 Jun 2020, at 01:30, Abby Spurdle  wrote:
> 
> If I understand your question correctly, you're already able to read
> an EPS file.
> So, essentially, you have an answer to your question.

Well - there are some dependencies (system as well as package dependencies) 
which I would like to cut down - that is why I am asking. 
> 
> Paul Murrell published an article on using raster graphics, in 2011.
> https://journal.r-project.org/archive/2011-1/RJournal_2011-1_Murrell.pdf
> 
> I would assume there's been progress since then.
> But I don't see the point here.

Depending on the use, it might be better to have a raster or a vector 
representation. But I agree - in general, is vector better.


> Writing what would otherwise be vector graphics to a raster-based

No - plantuml can also produce png graphs - these are the ones I am using for 
the raster representation.

> image file, and then reading it back into a vector graphics system,
> would create unnecessary problems.

That one is true.


Thanks,

Rainer

> 
> 
> On Sat, Jun 20, 2020 at 2:56 AM Rainer M Krug  wrote:
>> 
>> 
>> Hi
>> 
>> I have a package, which plots from the plantuml syntax 
>> (https://plantuml.com) graphs via a knitr engine, into a file, or into a 
>> graphics device (https://github.com/rkrug/plantuml).
>> 
>> I am using at the moment grImport for the eps import, but would like to cut 
>> down on dependencies.
>> 
>> Is there a way of bringing graphics files (png, sag, eps, …) into a graphics 
>> device in R?
>> 
>> Thanks,
>> 
>> Rainer
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
>> UCT), Dipl. Phys. (Germany)
>> 
>> Orcid ID: -0002-7490-0066
>> 
>> Department of Evolutionary Biology and Environmental Studies
>> University of Zürich
>> Office Y34-J-74
>> Winterthurerstrasse 190
>> 8075 Zürich
>> Switzerland
>> 
>> Office: +41 (0)44 635 47 64
>> Cell:   +41 (0)78 630 66 57
>> email:  rainer.k...@uzh.ch
>>rai...@krugs.de
>> Skype: RMkrug
>> 
>> PGP: 0x0F52F982
>> 
>> __
>> 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.

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Orcid ID: -0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Zürich
Office Y34-J-74
Winterthurerstrasse 190
8075 Zürich
Switzerland

Office: +41 (0)44 635 47 64
Cell:   +41 (0)78 630 66 57
email:  rainer.k...@uzh.ch
rai...@krugs.de
Skype: RMkrug

PGP: 0x0F52F982




[[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] Load svg, eps or png into graphics device?

2020-06-22 Thread Rainer M Krug



> On 21 Jun 2020, at 22:42, Paul Murrell  wrote:
> 
> Hi
> 
> Do you mean you want to reduce *system requirements* ?

system requirements and package dependencies. Yes.

>  I'm not sure you have many options.

That was my impression as well, and that is why I asked here - possibly 
somebody has any smart idea.


>  Looking at the plantuml output format options, there is ...
> 
> png via 'png', which requires libpng

Yup.

> svg via 'grImport2', which requires 'rsvg', which requires librsvg2

Tried it, but did not work as well as

> eps via 'grImport', which requires ghostscript

Which I am using for the vector graph.

> 
> ... and a number of other formats that cannot be read directly into R AFAIK.
> 
> The only option that does not require dependencies looks like the "txt" 
> format, which you could read in with readLines(), but I'm not sure you want 
> an ASCII art version :)

Actually, it could actually be an option if none of the above is installed. 
Kind of cascading, depending if installed: eps - sag - png - ASCII art.

Thanks,

Rainer


> 
> Paul
> 
> On 20/06/20 2:56 am, Rainer M Krug wrote:
>> Hi
>> I have a package, which plots from the plantuml syntax 
>> (https://plantuml.com) graphs via a knitr engine, into a file, or into a 
>> graphics device (https://github.com/rkrug/plantuml).
>> I am using at the moment grImport for the eps import, but would like to cut 
>> down on dependencies.
>> Is there a way of bringing graphics files (png, sag, eps, …) into a graphics 
>> device in R?
>> Thanks,
>> Rainer
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
>> UCT), Dipl. Phys. (Germany)
>> Orcid ID: -0002-7490-0066
>> Department of Evolutionary Biology and Environmental Studies
>> University of Zürich
>> Office Y34-J-74
>> Winterthurerstrasse 190
>> 8075 Zürich
>> Switzerland
>> Office:  +41 (0)44 635 47 64
>> Cell:+41 (0)78 630 66 57
>> email:  rainer.k...@uzh.ch
>>  rai...@krugs.de
>> Skype: RMkrug
>> PGP: 0x0F52F982
>> __
>> 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.
> 
> -- 
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> p...@stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Orcid ID: -0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Zürich
Office Y34-J-74
Winterthurerstrasse 190
8075 Zürich
Switzerland

Office: +41 (0)44 635 47 64
Cell:   +41 (0)78 630 66 57
email:  rainer.k...@uzh.ch
rai...@krugs.de
Skype: RMkrug

PGP: 0x0F52F982




[[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.