> # >> # Generate the figures (on screen) >> # >> # Image generation - function definition >> pic_onscr<-function(matrix, title, cex_val=1) > + {x11() + par(mgp=c(5,2,0), # axis margins + # (title, > labels, line) + mar=c(7,4,4,2), # plot margins (b,l,t,r) + > las=1) # horizontal labels + plot(matrix, # data to plot + > cex=cex_val, # font size + dimen=2 # dimensions to plot + > ) + title(main=title) # title of plot + } >> # Plot LDA scores with sample names >> pic_onscr(lda_result,"Linear Discriminant Analysis") > Error in plot(matrix, cex = cex_val, dimen = 2) : error in > evaluating the argument 'x' in selecting a method for > function 'plot': Error: object 'lda_result' not found >> # For plotting with larger font size, use a different >> value of cex: # pic_onscr(lda_result, "LDA Plot", >> dimen=2, cex=3) >> >> # >> # Generate figures as image files >> # >> # (Uncomment blocks as necessary) >> >> ##### jpeg ##### # pic_jpg<-function(filename, matrix, >> title, cex_val=1) # {# Start jpeg device with basic >> settings # jpeg(filename, # quality=100, # image quality >> (percent) # bg="white", # background colour # res=300, # >> image resolution (dpi) # units="in", width=8.3, >> height=5.8 # image dimensions (inches) # ) # >> par(mgp=c(5,2,0), # axis margins # # (title, labels, >> line) # mar=c(7,4,4,2), # plot margins (b,l,t,r) # las=1 >> # horizontal labels # ) # # Draw the plot # plot(matrix, >> # data to plot # cex=cex_val, # font size # dimen=2 # >> dimensions to plot # ) # title(main=title) # title of >> plot >> # >> # dev.off() # } # pic_jpg("LDA.jpg", lda_result, "Linear >> Discriminant Analysis") ##### end jpeg ##### >> >> ##### png ##### # pic_png<-function(filename, matrix, >> title, cex_val=1) # {# Start png device with basic >> settings # png(filename, # bg="white", # background >> colour # res=300, # image resolution (dpi) # units="in", >> width=8.3, height=5.8 # image dimensions (inches) # ) # >> par(mgp=c(5,2,0), # axis margins # # (title, labels, >> line) # mar=c(7,4,4,2), # plot margins (b,l,t,r) # las=1 >> # horizontal labels # ) # # Draw the plot # plot(matrix, >> # data to plot # cex=cex_val, # font size # dimen=2 # >> dimensions to plot # ) # title(main=title) # title of >> plot >> # >> # dev.off() # } # pic_png("LDA.png", lda_result, "Linear >> Discriminant Analysis") ##### end png ##### >> >> ##### tiff ##### # pic_tiff<-function(filename, matrix, >> title, cex_val=1) # {# Start tiff device with basic >> settings # tiff(filename, # bg="white", # background >> colour # res=300, # image resolution (dpi) # units="in", >> width=8.3, height=5.8, # image dimensions (inches) # >> compression="none" # image compression # # (one of none, >> lzw, zip) # ) # par(mgp=c(5,2,0), # axis margins # # >> (title, labels, line) # mar=c(7,4,4,2), # plot margins >> (b,l,t,r) # las=1 # horizontal labels # ) # # Draw the >> plot # plot(matrix, # data to plot # cex=cex_val, # font >> size # dimen=2 # dimensions to plot # ) # >> title(main=title) # title of plot >> # >> # dev.off() # } # pic_tiff("LDA.tif", lda_result, "Linear >> Discriminant Analysis") ##### end tiff ##### >>
could you show me howto use the LDA.R.. the graph not display [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.