Displaying 6 results from an estimated 6 matches for "trialdata4".
Did you mean:
trialdata
2023 Jul 07
1
Plotting factors in graph panel
Hallo Anupam
I do not see much difference in ggplot or lattice, they seems to me provide almost identical results when removing theme part from ggplot.
library(ggplot2)
library(lattice)
ggplot(TrialData4, aes(x=Income, y=Percent, group=Measure)) + geom_point() +
geom_line() + facet_wrap(~Measure)
xyplot(Percent ~ Income | Measure, TrialData4,
type = "o", pch = 16, as.table = TRUE, grid = TRUE)
So it is probably only matter of your preference which one do you choose.
Cheers
Pet...
2023 Jul 07
1
Plotting factors in graph panel
...t 12:02, PIKAL Petr <petr.pikal at precheza.cz> wrote:
> Hallo Anupam
>
> I do not see much difference in ggplot or lattice, they seems to me
> provide almost identical results when removing theme part from ggplot.
>
> library(ggplot2)
> library(lattice)
>
> ggplot(TrialData4, aes(x=Income, y=Percent, group=Measure)) + geom_point()
> +
> geom_line() + facet_wrap(~Measure)
>
> xyplot(Percent ~ Income | Measure, TrialData4,
> type = "o", pch = 16, as.table = TRUE, grid = TRUE)
>
> So it is probably only matter of your preference whi...
2023 Jul 06
2
Plotting factors in graph panel
...on the axes
> and does axes labels well. However, I cannot figure out how to do it in
> "lattice".
You will need to convert Income to a factor first. Alternatively, use
dotplot() instead of xyplot(), but that will sort the levels wrongly,
so better to make the factor first anyway.
TrialData4 <- within(TrialData4,
{
Income <- factor(Income, levels = c("$10", "$25", "$40", "$75", "> $75"))
})
xyplot(Percent ~ Income | Measure, TrialData4,
type = "o", pch = 16, as.table = TRUE, grid = TRUE)
or
dotplot(Perce...
2023 Jul 06
1
Plotting factors in graph panel
...a
> graph. I am not too happy with it. I am looking for something simpler and
> cleaner. Plot is attached.
>
> I also tried "lattice" package, but nothing got plotted with "xyplot"
> command, because it is looking for a numeric variable on x-axis.
>
> ggplot(TrialData4, aes(x=Income, y=Percent, group=Measure)) + geom_point()
> +
> geom_line() + facet_wrap(~Measure) + theme_classic()
>
> > dput(TrialData4)structure(list(Income = c("$10", "$25", "$40", "$75", "> $75",
> "$10", "...
2023 Jul 06
1
Plotting factors in graph panel
...used "ggplot" to make a
graph. I am not too happy with it. I am looking for something simpler and
cleaner. Plot is attached.
I also tried "lattice" package, but nothing got plotted with "xyplot"
command, because it is looking for a numeric variable on x-axis.
ggplot(TrialData4, aes(x=Income, y=Percent, group=Measure)) + geom_point() +
geom_line() + facet_wrap(~Measure) + theme_classic()
> dput(TrialData4)structure(list(Income = c("$10", "$25", "$40", "$75", "> $75",
"$10", "$25", "$40&quo...
2023 Jun 29
1
Plotting factors in graph panel
Anupa,
I think your best bet with your data would be to tidy it up in Excel, read
it into R using something like the readxl package and then supply some
sample data is the dput() function.
In the case of a large dataset something like dput(head(mydata, 100))
should supply the data we need. Just do dput(mydata) where *mydata* is your
data. Copy the output and paste it here.
On Thu, 29 Jun 2023