[R] Party plots
I'm pretty new to R, and not much of a progammer (yet). I'm having trouble navigating the graphical output for the party algorithm. Essentially, my tree is too large for the default page size so the nodes overlap and obscure one another. Anybody know how to change the plot parameters to either: 1) enlarge the page size so the default font fits comfortably (preferred); 2) shrink the graphics to fit the default page size (I worry that this might make exports illegibly small); or 3) show the tree in sections (not optimal, but servicable). Any assistance offered is truly welcome. Thanks -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25277282.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Party plots
Achim Zeileis wrote: > > >>>You can easily plot into a large PDF, e.g., something like this > >>> pdf(file = "foo.pdf", height = 15, width = 20) >>> plot(foo) >>> dev.off() > >>>and then view the PDF in an external viewer, zooming into parts of a tree >>>etc. Depending on the size of the tree in "foo", you might have to adjust >>>height/width accordingly. > > Thanks very much. That sounds like just what I'm looking for and have been unable to ferret out in my search through manuals and forums. I'm still a bit stuck though, because of my unfamiliarity with pulling stuff in and out of R. How do you get the initial .pdf file that you're manipulating here? I tried saving the R graphic to a PDF on my desktop and then running pdf (file = C:/Documents and Settings/aelmore/Desktop/foo.pdf, height = 15, width = 20) plot (foo) dev.off() but that netted me the error: unexpected '/' in "pdf(file = C:/ and of course trying it without the string returned the error: object "foo" not found. What am I missing? Is the graphic that R displays when I call for a plot somehow available for use here? If so, I don't know what it's called/how to access it. The name of the regression tree that it represents doesn't work. That attempt gave me the error: cannot coerce type 'S4' to vector of type 'character.' So, as you see, closer but still stuck. Thanks again in advance for any assistance. -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25283024.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Party plots
Nordlund, Dan (DSHS/RDA) wrote: > > > You need to put the filename in quotes > > file = "C:/Documents and Settings/aelmore/Desktop/foo.pdf" > > Hope this is helpful, > > Dan Oh yes, this was very helpful (and don't I feel just too silly...). I am, however, still stuck. This is like pulling teeth, how ridiculous that I can't get this simple code to work. Here is what I have: > #opening the pdf with a larger document size > pdf(file = "C:/SFL_2005_PCA27R_7_tree_full.pdf", height = 15, width = 20) That seems to work okay (no errors, at any rate - I get the next prompt line). Then I try: > #plotting the pdf > plot(SFL_2005_PCA27R_7_tree_full) and this nets me: Error: object "SFL_2005_PCA27R_7_tree_full" not found Error in plot(SFL_2005_PCA27R_7_tree_full) : error in evaluating the argument 'x' in selecting a method for function 'plot' but turning off the PDF driver works okay: > #turning off the device > dev.off() null device 1 If I open the pdf with Acrobat, the file is definitely there, albeit still crowded. It's not like the file is empty or anything. I am mystified. -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25293056.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Party plots SOLVED
"Quote from Petr PIKAL" > No, no. Here you need to do your plotting routine. > Something like > plot(1:10, rnorm(10)) > Now you can open it by e.g. Acrobat Reader or any suitable programme. Do > not forget to quit from Acrobat when trying to use the file again, if it > is opened it can not accept data from R. > Regards > Petr "quote" Ah. This process finally makes sense. Thank you so much. I initially thought we were taking a pdf export of the graphic produced inside the R workspace and re-arranging it into a larger space (somehow... ???). But your comment suggests to me that I'm actually bringing my results (not the graphic) into the pdf device and then plotting them. Duh. So this is what I did, based on that suggestion: # opening a large pdf with of my ctree object pdf("PCA27R_7_ct ", height = 15, width = 20) # plotting the pdf plot(PCA27R_7_ct, terminal_panel = node_hist(PCA27R_7.ct, ymax = 5, horizontal = FALSE, freq = TRUE)) # turning off the acrobat driver dev.off() It finally produced my 20" X 15" pdf, rather than the 5.57" X 5.57" default I was getting previously. Man the learning curve for newbie programmers... I cannot tell you guys how helpful it is to have folks like you out there, willing to wade through our messes and offer assistance. Many thanks, Annie -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25294703.html Sent from the R help mailing list archive at Nabble.com. __ 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.
[R] two party questions: terminal stats and second dataset
Hi there, Question 1: Anybody out there know if there is a way to retrieve a list/table of ctree terminal node stats? If I could get a list containing each terminal node, and distributional stats for the training observations allocated to it (e.g., mean, standard deviation, range), I would be a truly happy camper. I see ways to get predicted values for each observation in the training data, and I see how to get a list detailing which obs are in which terminal node, but I haven't yet figured out a way to get a list that just lists the terminal nodes and their stats. Question 2: Is there a way to take a ctree and run an independent validation dataset through it? I'm probably being obtuse - it seems like this should be a really straight forward operation - but I'm just not getting it. I have a regression tree of elevations dependent on spectral data and geographic coordinates and would like to test it against my independent data. I can do this by shifting results back and forth through various image processing, GIS and Excel programs, but it seems like it would be more efficient to do it in R, if there is a way. Anybody know? Thanks -- View this message in context: http://www.nabble.com/two-party-questions%3A-terminal-stats-and-second-dataset-tp25455694p25455694.html Sent from the R help mailing list archive at Nabble.com. __ 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.
[R] cforest regressions - mean of squared residuals
Hi there, I haven't been able to locate a way to get at this information in the manual or tutorial. Does anybody know how to retrieve it? Or amount of variance explained? Thanks, Annie -- View this message in context: http://www.nabble.com/cforest-regressions---mean-of-squared-residuals-tp25783906p25783906.html Sent from the R help mailing list archive at Nabble.com. __ 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.