Plot numeric and categorical variable
My data consists of numeric (yy) and categorical (xx) variables, as shown below.?
xx = c(rep("C", 5), rep("D",5))> xx?[1] "C" "C" "C" "C" "C" "D" "D" "D" "D" "D"> yy = rnorm(10, 0, 4)> yy?[1] ?2.7219346 -3.7142481 ?6.8716534 -0.9352463 ?0.4901249 ?3.8113247?[7] -2.6602041 ?1.7714471 ?4.7298233 ?0.8848188
xx1 = as.integer(as.factor(xx))> plot(xx1, yy, ylim = c(-13.5, 4), col="blue")
I have attached the plot above ?as plot1 I wish to generate a scatter plot of the data such that instead of 1 it prints C, and instead of 2, it prints D on the x- axis (see plot1 attached). How could I possibly go about this, let me know. Any help will be greatly appreciated. Thanks in advance for your help,JN