powered by
Function for making clean, good looking scatter plots with the option to add marginal denisty or box plots.
scat(data, x, y, group = NULL, marg = "none", line = "none", se = FALSE)
the data as a data frame
a string naming the variable from data that contains the x coordinates of the points in the plot, variable must be numeric
data
a string naming the variable from data that contains the y coordinates of the points in the plot, variable must be numeric
a string naming the variable from data that represents the grouping variable
none (default), dens, or box, provide respectively no plots, density plots, or box plots on the axes
none
dens
box
none (default), linear, or smooth, provide respectively no regression line, a linear regression line, or a smoothed regression line
linear
smooth
TRUE or FALSE (default), show the standard error for the regression line
TRUE
FALSE
A results object containing:
results$scat
# NOT RUN { set.seed(1337) X <- rnorm(100) Y <- 0.5*X + rnorm(100) dat <- data.frame(X = X, Y = Y) scat(dat, x = 'X', y = 'Y', line = 'linear', se = TRUE, marg = 'dens') # }
Run the code above in your browser using DataLab