Displaying 20 results from an estimated 3000 matches similar to: "substr gives empty output"
2018 Jan 21
3
substr gives empty output
Dear all,
I have a string, let's say "testing", and I would like to extract in
sequence each letter (character) from it. But when I use substr() I only
properly get the first character, the rest is empty (""). What am I getting
wrong?
For example, I have this code:
>>>
x <- "testing"
k <- nchar(x)
for (i in 1:k) {
y <- substr(x, i, 1)
2020 Oct 26
0
How to shade area between lines in ggplot2
Hi
Put fill outside aes
p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2],
ymax = slope_1*x + intercept_1 + 1/w[2]), fill = "blue", alpha=0.1)
The "hole" is because you have two levels of data (red and blue). To get rid
of this you should put new data in ribbon call.
Something like
newdat <- trainset
newdat$z <- factor(0)
p+geom_ribbon(data=newdat, aes(ymin =
2020 Oct 23
2
How to shade area between lines in ggplot2
Thank you, but this split the area into two and distorts the shape of
the plot. (compared to
```
p + geom_abline(slope = slope_1, intercept = intercept_1 - 1/w[2],
linetype = "dashed", col = "royalblue") +
geom_abline(slope = slope_1, intercept = intercept_1 + 1/w[2],
linetype = "dashed", col = "royalblue")
```
Why there
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi
What about something like
p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2],
ymax = slope_1*x + intercept_1 + 1/w[2], fill = "grey70", alpha=0.1))
Cheers
Petr
> -----Original Message-----
> From: Luigi Marongiu <marongiu.luigi at gmail.com>
> Sent: Friday, October 23, 2020 11:11 AM
> To: PIKAL Petr <petr.pikal at precheza.cz>
> Cc: r-help
2020 Oct 31
2
fast way to find most common value across columns dataframe
As usual, a web search ("find statistical mode in R") brought up something
that is possibly useful -- Did you try this before posting? If not, please
do so in future and let us know what your results were if you subsequently
post here.
Here's what SO suggested:
Mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
# ergo:
2020 Oct 20
0
How to assign the same levels to a dataframe column?
Stop using as.factor() and start using factor()? Be explicit about what levels you want and in what order.
As for extracting subsets, use split() and do your subsets on each set of rows with the same level. It will be on you to decide what statistical properties (proportions?) you want to maintain between the full data set and your subset.
On October 20, 2020 6:42:27 AM PDT, Luigi Marongiu
2023 Oct 24
2
How to Calculate the Mean by Multiple Groups in R
Hi,
I think you're misunderstanding which set of variables go on either
side of the formula.
Is this what you're looking for?
> aggregate(OD ~ Time + Target + Conc, data = df, FUN = "mean")
Time Target Conc OD
1 1 BACT 1 765.3333
2 1 BACT 2 745.3333
3 1 BACT 3 675.0000
> aggregate(ODnorm ~ Time + Target + Conc, data = df, FUN =
2020 Oct 31
0
fast way to find most common value across columns dataframe
Thank you. The problem was not finding the mode but applying it the R
way (I have the tendency to loop into each line of the dataframes,
which I believe is NOT the R way).
I'll try them.
Best regards
Luigi
On Sat, Oct 31, 2020 at 5:40 PM Bert Gunter <bgunter.4567 at gmail.com> wrote:
>
> As usual, a web search ("find statistical mode in R") brought up something that is
2020 Oct 31
0
fast way to find most common value across columns dataframe
Hi Luigi,
If I understand your request:
library(prettyR)
apply(as.matrix(df),1,Mode)
[1] "C" "B" "D" ">1 mode" ">1 mode" ">1 mode" "D"
[8] "C" "B" ">1 mode"
Jim
On Sat, Oct 31, 2020 at 7:56 PM Luigi Marongiu <marongiu.luigi at gmail.com>
wrote:
2012 Sep 18
4
add reference lines (or grid) in background
Dear all,
Is there a simple way to add reference lines in background? I am trying with
abline() or grid() but the lines, since they are executed after the plot
function, are draw on top. How can I draw such lines beneath the main plot?
Here is an example:
x<-rnorm(100)
boxplot(x)
abline(h=c(-1,0,1))
grid(NA, 4, lwd = 2)
regards,
Luigi Marongiu, MSc
[[alternative HTML
2012 Jun 13
2
Median line with stripchart
Dear all,
I would like to ask if it possible to draw a median line in a Stripchart,
either using the built-in STRIPCHART function or with another package.
I was expecting stripchart() to work more or less like boxplot(), but I
couldn't find an easy way to draw a mean or median line, neither I found
this option in other packages.
Could somebody help?
Best regards,
Luigi Marongiu, MSc
2020 Jul 14
1
How to install libisl.so.19 on chromebook?
I don't know about the configuration. I installed R using the standard
protocol for Chromebook
http://blog.sellorm.com/2018/12/20/installing-r-and-rstudio-on-a-chromebook/
the rest, it was done by the system itself...
On Tue, Jul 14, 2020 at 1:30 PM Dirk Eddelbuettel <edd at debian.org> wrote:
>
>
> There is something wrong with your system / setup I did not notice first:
>
2020 Oct 23
2
How to shade area between lines in ggplot2
also from this site: https://plotly.com/ggplot2/geom_ribbon/
I get the answer is geom_ribbon but I am still missing something
```
#! plot
p = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
geom_point() + scale_color_manual(values = c("red", "blue"))
# show support vectors
df_sv = trainset[svm_model$index, ]
p = p + geom_point(data = df_sv, aes(x=x, y=y),
2020 Oct 28
0
R for-loop to add layer to lattice plot
On Tue, Oct 27, 2020 at 6:04 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote:
>
> Hello,
> I am using e1071 to run support vector machine. I would like to plot
> the data with lattice and specifically show the hyperplanes created by
> the system.
> I can store the hyperplane as a contour in an object, and I can plot
> one object at a time. Since there will be
2023 Oct 24
1
How to Calculate the Mean by Multiple Groups in R
Also,
> aggregate(cbind(OD, ODnorm) ~ Time + Target + Conc, data = df, FUN = "mean")
Time Target Conc OD ODnorm
1 1 BACT 1 765.3333 108.33333
2 1 BACT 2 745.3333 88.33333
3 1 BACT 3 675.0000 18.00000
(You might wish for "cbind(OD,ODnorm) ~ . - Well", but aggregate.formula is not smart enough for that.)
-pd
> On 24 Oct 2023, at
2020 Jul 14
2
How to install libisl.so.19 on chromebook?
Thank you, it looks like I have already libisl:
```
apt search libisl
Sorting... Done
Full Text Search... Done
libisl-dbg/oldstable 0.18-1 amd64
manipulating sets and relations of integer points bounded by linear
constraints
libisl-dev/oldstable 0.18-1 amd64
manipulating sets and relations of integer points bounded by linear
constraints
libisl15/oldstable,now 0.18-1 amd64
2012 Jun 22
2
Boxplot with Log10 and base-exponent axis
Dear all,
I would like to (i) produce boxplot graphs with axis in logarithm in base 10
and (ii) showing the values on the axis in 10^exponent format rather than
10E+exponent.
To illustrate with an example, I have some widely spread data that I chart
plot using boxplot() [figure on the left]; the log="y" option of boxplot()
I obtained the natural logarithm conversion of the data and
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi
Did you try google? I got several answers using your question
e.g.
https://stackoverflow.com/questions/54687321/fill-area-between-lines-using-g
gplot-in-r
Cheers
Petr
> -----Original Message-----
> From: R-help <r-help-bounces at r-project.org> On Behalf Of Luigi Marongiu
> Sent: Friday, October 23, 2020 9:59 AM
> To: r-help <r-help at r-project.org>
> Subject:
2023 Mar 23
1
How to test the difference between paired correlations?
Thank you, but this now sounds more difficult: what would be the point
in having these ready-made functions if I have to do it manually?
Anyway, How would I implement the last part?
On Thu, Mar 23, 2023 at 1:23?AM Ebert,Timothy Aaron <tebert at ufl.edu> wrote:
>
> If you are open to other options:
> The null hypothesis is that there is no difference.
> If I have two equations
2024 Mar 05
1
How to invert axis within defined range with ggplot2 scale_y_reverse?
On 05/03/2024 7:16 a.m., Luigi Marongiu wrote:
> A <- rep(c(0, 3, 6, 12, 24), 3)
> B <- c(rep(0,5), rep(1,5), rep(2,5))
> V <- c(27.5, 27.01, 27.75, 27.98, 27.4, 25.69,
> 26.17, 27.78, 26.08,
> 24.97, 23.18, 21.78, 22.49, 21.85, 22.2)
> df <- data.frame(Conc = A, Time = B, Value = V)
> df$Conc = as.factor(df$Conc)
>