+1 vote

I have data on the catch rate of certain species of fish.

```fish 1  fish 2  fish 3
0.000   3.265   9.872
2.147   1.013   0.000```

I have calculated the mean catch rate for each fish using:

`a <- colMeans(df)`

I have also calculated the standard error:

`stdError <- (sapply(df,sd))/sqrt(length(df))`

I have created a dotplot using:

`dotplot(a, xlab="mean catch", ylab = "species",las =2,)`

How do I add error bars to this plot? I would prefer not to use ggplot if possible. I am currently using the inbuilt functions in R but have access to Lattice.

Nov 6, 2018 291 views

## 1 answer to this question.

You can probably use dot plot for this purpose. The dot plot as a representation of a distribution consists of group of data points plotted on a simple scale. Dot plots are used for continuous, quantitative, univariate data. Data points may be labelled if there are few of them. Dot plots are one of the simplest statistical plots, and are suitable for small to moderate sized data sets. They are useful for highlighting clusters and gaps, as well as outliers.

The Hmisc package extends most lattice functions to better incorporate confidence intervals.

Here's an example of how you would use it. Note that we combine the data you want to plot here into a data.frame so we can use a proper formula symtax

```mm<-data.frame(a,stdError, fish=names(a))
library(lattice)
library(Hmisc)
Dotplot(fish~Cbind(a, a-stdError, a+stdError), mm,
xlab="mean catch", ylab = "species",las =2)```
• 52,350 points

## Plotting multiple graphs on the same page in R

If you want to plot 4 graphs ...READ MORE

## What is the standard naming convention for the variables in R?

Use of period separator e.g. product.prices <- c(12.01, ...READ MORE

## Error saying "Error in rnorm() : argument "n" is missing, with no default" in R

Hey @ali, rnorm() function requires an argument, ...READ MORE

+1 vote

## "Error in eval(ei, envir) : object 'RDX2' not found" when trying to source the code in R

This is a very common issue that ...READ MORE

+1 vote

## Stacked barchart - R programming with ggplot2

Use position = stack inside geom_bar() ggplot(mydata, aes(x = ...READ MORE

## How to color geom_bar by y-axis values?

You can use cut ggplot(cars, aes(x = as.factor(cyl))) + ...READ MORE

## Loop to automate the plotting process in R

Try something like this: library(tidyverse) data(iris) ## create a grid ...READ MORE

+1 vote

## How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE