Solution: Stata’s spagplot errorneously plots vertical lines

Stata’s spagplot fails and plots vertical lines, but there is an easy solution in R.

library(foreign) data <- read.dta("C:/Users/hellmund/Documents/MyStataDataFile.dta") names(data) levels(data$group) #First column contains initial measurements, k’th column measurements at time k dataLong <- reshape(data, direction="long", varying=list(names(data)[1:10]), v.names=NULL,idvar=c("id"), timevar="Visit", times=1:10) png(file=”C:/Users/hellmund/Documents/spagplot.png”, bg=”transparent”) interaction.plot(dataLong$Visit,dataLong$id, dataLong$Size xlab=”Visit”, ylab=”Size(mm)”, legend=F,lty=1, ylim=c(30,70)) #Critical cut-off value is marked with a horizontal line abline(h=55)

1 view0 comments

Recent Posts

See All

SAS University Edition load error solution

Using SAS University Edition with VirtualBox in Fedora requires kernel signing of 3 modules. Avoid this by disabling Secure Boot in BIOS settings. Secure Boot makes it impossible to load nonauthorized