[R] Use R to plot a directory tree
jttkim at googlemail.com
Thu Oct 24 17:38:32 CEST 2013
perhaps as a somewhat tamer guess than Bert's, it's probably not
very hard to write a function that pieces together a dendrogram
(S3 class provided by the stats package), using the list.dirs and
This could then be plotted via the plot function, and you could
even designate attributes such as colours, line thicknesses etc.
to highlight e.g. the largest files.
I'm not too sure, though, how useful this would be for plotting
directory trees for restructuring them; any tree that's complex
enough to require the use of such auxiliary tools will very likely
have at least a few hundred files, and thus labels will end up
either overlapping everywhere or illegibly small.
Best regards, Jan
On Thu, Oct 24, 2013 at 09:20:30AM -0500, Marc Schwartz wrote:
> One R package that might be of interest would be 'diagram':
> I would also agree with Bert here and would point you in the direction of PSTricks, which can handle these sorts of complex figures. It would of course require learning LaTeX, but that is a good thing. :-)
> More info here:
> and lots of examples with code here:
> I use PSTricks for creating things like subject disposition flow charts for clinical study reports.
> Marc Schwartz
> On Oct 24, 2013, at 8:47 AM, Bert Gunter <gunter.berton at gene.com> wrote:
> > A wild guess -- take a look at the CRAN "phylohenetics" task view, as
> > that sounds like the sort of thing that might have tree generation and
> > manipulation functions.
> > ... but you may do better with some non-R tool out there.
> > (Hopefully, you'll get a better response, though).
> > Cheers,
> > Bert
> > On Thu, Oct 24, 2013 at 6:13 AM, Thaler,Thorn,LAUSANNE,Applied
> > Mathematics <Thorn.Thaler at rdls.nestle.com> wrote:
> >> Dear all,
> >> I was wondering whether (or better: how) I can use R to read recursively a directory to get all the sub-folders and files located in the root folder and put it into a tree like structure where the leaves are files and intermediate nodes are the directories? The idea is that I'd like to plot the structure of a certain root folder to be able to restructure the file system.
> >> Any ideas on that? I was googling a lot but apparently I did not use the right terms ("R tree folder" or "R tree directory" takes me mainly to pages about the "R-tree" a structure for spatial access methods [at least I learnt something new ;)])
> >> Any pointer to the right function is highly appreciated.
> >> Cheers,
> >> Thorn Thaler
> >> NRC Lausanne
> >> Applied Mathematics
> >> ______________________________________________
> >> R-help at 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.
> > --
> > Bert Gunter
> > Genentech Nonclinical Biostatistics
> > (650) 467-7374
> > ______________________________________________
> > R-help at 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-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
+- Jan T. Kim -------------------------------------------------------+
| email: jttkim at gmail.com |
| WWW: http://www.jtkim.dreamhosters.com/ |
*-----=< hierarchical systems are for files, not for humans >=-----*
More information about the R-help