Does anyone know if there is a package or simple way in R to create tree structures of the following form:

![enter image description here](https://i.stack.imgur.com/1PN5q.jpg)

I am not looking for a way to create a nice plot like above. My biggest problem is finding a way to work with such a tree where there is a clear distinction between nodes, leaves and children-nodes. For example I would like to be able to switch two leaves by adjusting a string or vector. So I guess this is mostly a 'data storage' problem.

I have been looking for quite some time now and stumbled upon a package called 'Dendrogram'. The problem with this package is that (as far as I know) it does not allow the labelling of inner nodes such as 'H'and 'V'. Only the final leaves can carry a value or string.

Another package I found is 'rpart' but I think these are only useful for regression trees.

If anyone knows something I would greatly appreciate the help!