Displaying 20 results from an estimated 210 matches for "reprexes".
Did you mean:
reprex'es
2018 Oct 29
1
disappearing paragraphs in html rendering of text from Rd macros
...em to change the HTML rendering of text returned by Rd macros,
in that now empty lines do not cause paragraphs to end (the empty lines are kept but <p> tags are not set).
As a result, multiple paragraphs are output as a single one.
A complete example Rd file is at: https://github.com/GeoBosh/reprexes/blob/master/disappearingParagraphs/a.Rd
rendered (2018-10-28) with R-devel: https://github.com/GeoBosh/reprexes/blob/master/disappearingParagraphs/a.html
and R-3.5.1patched: https://github.com/GeoBosh/reprexes/blob/master/disappearingParagraphs/a351.html
The exact system information used for r...
2023 Jan 25
2
Potential bug in fitted.nls
Dear Colleagues,
I recently answered [this question]() on StackOverflow that identified
what seems to be unusual behaviour with `stats:::nls.fitted()`. In
particular, a null model returns a single fitted value rather than a
vector of the same fitted value of `length(y)`. The documentation
doesn?t make it seem like this is the intended behaviour, so I?m not
sure if it?s a bug, a ?Wishlist?
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Hi,
Firstly, apologies as I have posted this on community.rstudio.com too.
I want to optimise a Box-Cox transformation on columns of a matrix (ie, a unique lambda for each column). So I wrote a function that includes the call to MASS::boxcox in order that it can be applied to each column easily. Except that I'm getting an error when calling the function. If I just extract a column of the
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Try this for your function:
BoxCoxLambda <- function(z){
y <- z
b <- boxcox(y + 1 ~ 1,lambda = seq(-5, 5, length.out = 61), plotit =
FALSE)
b$x[which.max(b$y)] # best lambda
}
***I think*** (corrections and clarification strongly welcomed!) that `~`
(the formula function) is looking for 'z' in the GlobalEnv, the caller of
apply(), and not finding it. It finds
2023 Jan 26
1
Potential bug in fitted.nls
Doesn't nls() expect that the lengths of vectors on both sides of the
formula match (if both are supplied)? Perhaps it should check for that.
-Bill
On Thu, Jan 26, 2023 at 12:17 AM Dave Armstrong <darmst46 at uwo.ca> wrote:
> Dear Colleagues,
>
> I recently answered [this question]() on StackOverflow that identified
> what seems to be unusual behaviour with
2019 Sep 20
2
ggplot con gradientes complejos
No sé muy bien, Carlos, como hacerlo, pero no parece más sencillo que lo de
multiplicar por 2 los positivos y después editar el mapa.
De lo que decías, Emilio, de cambiar el color del punto central creo que
haría más confusa la interpretación.
El vie., 20 sept. 2019 a las 10:33, Carlos Ortega (<cof en qualityexcellence.es>)
escribió:
> Hola,
>
> Una alternativa que suele
2019 Sep 20
2
ggplot con gradientes complejos
Gracias Emilio. Si, son asimétricos porque se mueven en rangos distintos.
De hecho, miden cosas distintas, pero una muestra no puede ser positiva y
negativa a la vez. Me planteo multiplicar las positivas por 2 y al editar
el mapa corregirlo para que indique los valores reales. Eso funcionaría,
pero son muchos mapas y quizás haya una función en ggplot que evite el
problema directamente.
Manuel
El
2015 Oct 13
1
A where() functions that does what exists() does but return the environment when object lives?
On Tue, Oct 13, 2015 at 4:43 PM, Hadley Wickham <h.wickham at gmail.com> wrote:
> Seems easy enough to write yourself:
>
> where <- function(x, env = parent.frame()) {
> if (identical(env, emptyenv()))
> return(NULL)
> if (exists(x, envir = env, inherits = FALSE))
> return(env)
> where(x, parent.env(env))
> }
>
> sample2 <-
2019 Jan 21
1
Request: make `var` a generic
Hi all,
I am running into problems using `summary.lm` as calling `var` on a `units`
object does not retain the `units` attribute.
The units package addresses this issue for `mean` by implementing
`mean.units`:
units:::mean.units
function (x, ...)
{
.as.units(NextMethod(), units(x))
}
This is, however, not possible for `var` (as it's not a generic), which
breaks `summary.lm`:
```
2017 Nov 26
0
dplyr - add/expand rows
To David W.'s point about lack of a suitable reprex ("reproducible
example"), Bill's solution seems to be for only one station.
Here is a reprex and modification that I think does what was requested for
multiple stations, again using base R and data frames, not dplyr and
tibbles.
First the reprex with **two** stations:
> d <- data.frame( station =
2019 Sep 19
2
ggplot con gradientes complejos
Muy buenas. Quiero hacer un mapa que me pinte en azul los valores negativos
y en rojo los positivos. Los negativos llegan hasta -400 y los positivos
hasta 200. Si pongo limits=c(-200, 200), me colorea bien los positivos
(rojo), pero los negativos por debajo de -200 me los pone gris. Si pongo
limits=c(-400, 200), me colorea bien los negativos (azul), pero los
positivos apenas se ven. Necesito que
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
No, I'm afraid I'm wrong. Something went wrong with my R session and gave
me incorrect answers. After restarting, I continued to get the same error
as you did with my supposed "fix." So just ignore what I said and sorry for
the noise.
-- Bert
On Sat, Jul 8, 2023 at 8:28?AM Bert Gunter <bgunter.4567 at gmail.com> wrote:
> Try this for your function:
>
>
2018 Apr 27
5
predict.glm returns different results for the same model
Hi all,
Very surprising (to me!) and mystifying result from predict.glm(): the
predictions vary depending on whether or not I use ns() or
splines::ns(). Reprex follows:
library(splines)
set.seed(12345)
dat <- data.frame(claim = rbinom(1000, 1, 0.5))
mns <- c(3.4, 3.6)
sds <- c(0.24, 0.35)
dat$wind <- exp(rnorm(nrow(dat), mean = mns[dat$claim + 1], sd =
sds[dat$claim + 1]))
dat <-
2017 Nov 26
3
dplyr - add/expand rows
dplyr may have something for this, but in base R I think the following does
what you want. I've shortened the name of your data set to 'd'.
i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sat, Nov 25, 2017 at 11:18 AM,
2017 Oct 24
0
Creating a data table (frame?) from a SQL Statement?
Please always cc the list... the group usually has better answers than any one person, and I don't do private consulting on the net. For future reference, there is also an r-sig-db mailing list where this question really belongs.
Since I almost never use jdbc, I would need a reprex (hint you are ignoring my advice... a good way to get ignored), which this still isn't. There is probably
2018 Apr 18
3
Understanding which
Dear All,
Here is a reprex:
> x<- 1:100
> x[-which(x>100)]
integer(0)
In words, I am finding out which indices correspond to values in x which
are greater than 100 ( there are no such items ) . Then I remove those
indices. I should get back the x that I started with since there are no
items in x which are bigger than 100 . Instead, it is returning an empty
vector.
Why is this ?
2023 Nov 04
1
Adding columns to a tibble based on a value in a different tibble
I think a simple reproducible example ("reprex") may be necessary for you
to get a useful reply. Questions with vague specifications such as yours
often result in going round and round with attempts to clarify what you
mean without a satisfactory answer. Clarification at the outset with a
reprex may save you and others a lot of frustration.
Cheers,
Bert
On Sat, Nov 4, 2023 at 1:41?AM
2017 Nov 28
1
dplyr - add/expand rows
Bert wrote
... Bill's solution seems to be for only one station.
No, it works for any number of stations.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sun, Nov 26, 2017 at 11:10 AM, Bert Gunter <bgunter.4567 at gmail.com>
wrote:
> To David W.'s point about lack of a suitable reprex ("reproducible
> example"), Bill's solution seems to be for only one
2017 Oct 24
2
Creating a data table (frame?) from a SQL Statement?
Hello,
I'm new to R so this is probably a simple question for somebody.
I have an RScript that reads a CSV on the disk using read.table(...). It then does a boxM test using that data.
However, I'm now trying to load the same data via an SQL command, but I can't seem to get the data structure defined so R will like it -- using the included "iris" dataset.
I've tried
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
Dear Ron and Bert,
First (and without considering why one would want to do this, e.g.,
adding a start of 1 to the data), the following works for me:
------ snip ------
> library(MASS)
> BoxCoxLambda <- function(z){
+ b <- boxcox(z + 1 ~ 1,
+ lambda = seq(-5, 5, length.out = 101),
+ plotit = FALSE)
+ b$x[which.max(b$y)]
+ }
> mrow <- 500