[R] how to draw a stripplot in vertical orientation, using lattice

Christopher Ryan cry@n @end|ng |rom b|ngh@mton@edu
Fri May 19 22:29:25 CEST 2023


I'm attempting to describe the height of a fall from a building, so the
vertical orientation has a certain attraction.

dd <- data.frame(nothing = rep(1:2, each = 6), height = runif(n=12, min=0,
max=30))
dd

## pretty much what I'm looking for
with(dd, stripchart(height, vertical = TRUE))

## but if possible  would like to do it with lattice and pipes
library(lattice)
library(dplyr)

dd %>% stripplot(~height, data = .)  ## default is horizontal
dd %>% stripplot(~height, data = ., horizontal = FALSE)    ## no
dd %>% stripplot(height ~, data = ., horizontal = FALSE)   ## a guess,
clearly not right
dd %>% stripplot(height ~ 1, data = ., horizontal = FALSE)  ## close, but
x-axis label and tic labels undesired
dd %>% stripplot(height ~ 1, data = ., horizontal = FALSE, xlab = NULL)  ##
closer
dd %>% stripplot(height ~ "", data = ., horizontal = FALSE)

The last line gets pretty much what I'm looking for, but it feels a bit . .
. unseemly.  height ~ "" ? There must be a more proper way, that I'm just
not thinking of.

Thanks.

--Chris Ryan

	[[alternative HTML version deleted]]



More information about the R-help mailing list