Hello Jean-Louis,
Noting the subject line of your post I thought the first answer would
have been encoding histology stages as factors, and "unclass-ing" them
to obtain integers that then can be mathematically manipulated. You
can get a lot of work done with all the commands listed on the
"factor"
xn <- as.numeric(sub("c",".7",sub("b",".5",sub("a",".3",xc
On Sat, Jul 11, 2020 at 5:09 AM Richard O'Keefe wrote:
> This can be done very simply because vectors in R can have
> named elements, and can be indexed by strings.
>
> > stage <- c("1" = 1, "1a" = 1.3, "1b" = 1.5, "1c" = 1.7,
> +
Hi Paulina,
Without data it's hard to work out what you are doing. Even a small
simulated data set would help to get answers.
Jim
On Fri, Jul 10, 2020 at 11:49 PM Paulina Skolasinska
wrote:
>
> 'm using ggplot2 to plot two variables at a time. I'm plotting two age groups
> and overall data on t
This can be done very simply because vectors in R can have
named elements, and can be indexed by strings.
> stage <- c("1" = 1, "1a" = 1.3, "1b" = 1.5, "1c" = 1.7,
+"2" = 2, "2a" = 2.3, "2b" = 2.5, "2c" = 2.7,
+"3" = 3, "3a" = 3.3, "3b" = 3.5, "3c" = 3.7)
> testdata <- rep
Last line should use outside = c (0, 1).
But not that important.
On Sat, Jul 11, 2020 at 1:31 PM Abby Spurdle wrote:
>
> NOTE: LIMITED TESTING
> (You may want to check this carefully, if you're interested in using it).
>
> library (kubik)
> library (mvtnorm)
>
> sim.cdf <- function (mx, my, sdx,
NOTE: LIMITED TESTING
(You may want to check this carefully, if you're interested in using it).
library (kubik)
library (mvtnorm)
sim.cdf <- function (mx, my, sdx, sdy, cor, ..., n=2e5)
sim.cdf.2 (mx, my, sdx^2, sdy^2, sdx * sdy * cor, n=n)
sim.cdf.2 <- function (mx, my, vx, vy, cov, ..., n=
Many thanks to all. This help-list is wonderful.
I have used Rich Heiberger solution using match and found something to learn in
each answer.
off topic, I also enjoyed very much his 2008 paper on the graphical
presentation of safety data
Best wishes.
On Fri, Jul 10, 2020, at 10:02 PM, F
Thanks! As I said, cute exercise.
Best,
Bert
On Fri, Jul 10, 2020 at 1:21 PM Fox, John wrote:
> Dear Bert,
>
> Wouldn't you know it, but your contribution arrived just after I pressed
> "send" on my last message? So here's how your solution compares:
>
> > microbenchmark(John = John <- xn[x]
Dear Bert,
Wouldn't you know it, but your contribution arrived just after I pressed "send"
on my last message? So here's how your solution compares:
> microbenchmark(John = John <- xn[x],
+Rich = Rich <- xn[match(x, xc)],
+Jeff = Jeff <- {
+ n
Hi,
We've had several solutions, and I was curious about their relative efficiency.
Here's a test with a moderately large data vector:
> library("microbenchmark")
> set.seed(123) # for reproducibility
> x <- sample(xc, 1e4, replace=TRUE) # "data"
> microbenchmark(John = John <- xn[x],
+
... and continuing with this cute little thread...
I found the OP's specification a little imprecise -- are your values always
a string that begins with *some sort" of numeric value followed by "some
sort" of alpha code? That is, could the numeric value be several digits and
the alpha code several
Here is a different approach:
xc <- c("1", "1a", "1b", "1c", "2", "2a", "2b", "2c")
xn <- as.numeric(gsub("a", ".3", gsub("b", ".5", gsub("c", ".7", xc
xn
# [1] 1.0 1.3 1.5 1.7 2.0 2.3 2.5 2.7
David L Carlson
Professor Emeritus of Anthropology
Texas A&M University
On Fri, Jul 10, 2020 at 1:
Obvious is in the eye of the beholder. Presuming your letters don't go beyond
"i":
a) Lookup table:
tbl <- read.table( text=
"OldCode NewCode
1 1
1a1.1
1b1.2
1c1.3
2 2
2a2.1
2b2.2
", as.is=TRUE, header=TRUE )
tblv <- setNames( tbl$NewCode
> xc <- c("1", "1a", "1b", "1c", "2", "2a", "2b", "2c")
> xn <- c(1, 1.3, 1.5, 1.7, 2, 2.3, 2.5, 2.7)
> testdata <- rep(c("1", "1a", "1b", "1c", "2", "2a", "2b", "2c"), times=1:8)
> testdata
[1] "1" "1a" "1a" "1b" "1b" "1b" "1c" "1c" "1c" "1c" "2" "2" "2" "2" "2"
[16] "2a" "2a" "2a" "2a" "2a
Dear Jean-Louis,
There must be many ways to do this. Here's one simple way (with no claim of
optimality!):
> xc <- c("1", "1a", "1b", "1c", "2", "2a", "2b", "2c")
> xn <- c(1, 1.3, 1.5, 1.7, 2, 2.3, 2.5, 2.7)
>
> set.seed(123) # for reproducibility
> x <- sample(xc, 20, replace=TRUE) # "data"
Dear All
I have a character vector, representing histology stages, such as for example:
xc <- c("1", "1a", "1b", "1c", "2", "2a", "2b", "2c")
and this goes on to 3, 3a etc in various order for each patient. I do have of
course a pre-established classification available which does change accor
'm using ggplot2 to plot two variables at a time. I'm plotting two age groups
and overall data on the same graph. I'm also using stat_cor form the ggpubr
package to report correlations for the two groups and overall data.
I want each stat_cor label to have a custom subscript - the group name ("o
Hi,
I would rather have a Statistics related question hope experts here can provide
some suggestions. I have posted this request in some other forum but failed to
generate meaningful response
I am looking for some technical document on deriving the Distribution function
for sum of 2 ReLU(𝑋)=max{
Dear Jim,
As I pointed out yesterday, setting ylim as you suggest still results in
"0e+00" as the smallest tick mark, as it should for evenly spaced ticks.
Best,
John
> On Jul 10, 2020, at 12:13 AM, Jim Lemon wrote:
>
> Hi Luigi,
> This is a result of the "pretty" function that calculates h
Thank you!
I reckon the main problem is the large data range, anyway. I should
stick with logarithmic scales...
Best regards
Luigi
On Fri, Jul 10, 2020 at 6:14 AM Jim Lemon wrote:
>
> Hi Luigi,
> This is a result of the "pretty" function that calculates hopefully
> good looking axis ticks automat
20 matches
Mail list logo