Re: [R] How to represent tree-structured values

2022-05-29 Thread Jim Lemon
Hi Richard, Some years ago I had a try at illustrating Multiple Causes of Death (MCoD) data. I settled on what is sometimes called a "sizetree". You can see some examples in the sizetree function help page in "plotrix". Unfortunately I can't use the original data as it was confidential. Jim On Mo

Re: [R] How to represent tree-structured values

2022-05-29 Thread Jeff Newmiller
Really this depends on the analysis you want to perform. In the past, I have used a super/sub two-column format as a compact, non-redundant representation for data entry, and after applying a recursive algorithm to convert this to a super/sub/level/id table where _all_ sub components have (dupl

[R] How to represent tree-structured values

2022-05-29 Thread Richard O'Keefe
There is a kind of data I run into fairly often which I have never known how to represent in R, and nothing I've tried really satisfies me. Consider for example ... - injuries ... - injuries to limbs ... - injuries to extremities ... - injuries to hands - i

Re: [R] categorizing data

2022-05-29 Thread David Carlson via R-help
Here is one way to get the table you are describing. First some made up data: dta <- structure(list(tree = c(27, 47, 33, 31, 45, 54, 47, 27, 33, 26, 14, 43, 36, 0, 29, 24, 43, 38, 32, 21, 21, 23, 12, 42, 34), shrub = c(19, 29, 27, 31, 5, 24, 6, 37, 4, 6, 59, 7, 23, 15, 32, 1, 31, 37, 30, 44, 40, 1

Re: [R] Circular Graph Recommendation Request

2022-05-29 Thread Christopher W. Ryan via R-help
If the units of analysis are real spatial regions (e.g. states), how about a cartogram? https://gisgeography.com/cartogram-maps/ An R package (I have no experience with it) https://cran.r-project.org/web/packages/cartogram/index.html The advantage of a cartogram is that it is a single graphic,

Re: [R] How to color boxplots with respect to the variable names

2022-05-29 Thread Neha gupta
Thank you so much Jim for your help. Best regards On Monday, May 30, 2022, Jim Lemon wrote: > Hi Neha, > As you have a distinguishing feature in the variable names, here is > one way to do it: > > RF<- c(4.7, 1.52, 1.46, 4.5, 0.62, 1.12) > RF_LOO<- c(5.2, 1.52, 1.44, 4.3, 0.64, 1.11) > RF_boot<

Re: [R] How to color boxplots with respect to the variable names

2022-05-29 Thread Jim Lemon
Hi Neha, As you have a distinguishing feature in the variable names, here is one way to do it: RF<- c(4.7, 1.52, 1.46, 4.5, 0.62, 1.12) RF_LOO<- c(5.2, 1.52, 1.44, 4.3, 0.64, 1.11) RF_boot<- c(5.8, 1.5, 1.23, 4.3, 0.64, 1.12) Ranger<- c(4.5, 1.57, 1.25, 3.75, 0.56, 1.09) Ranger_LOO<- c(5, 1.56, 1.

Re: [R] categorizing data

2022-05-29 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi Janet: here is a start to give you the idea, now you need loop either use a "for" or one of the apply functions. 1. Preallocate new data (i am lazy so it is array, for example of size three. 2. order the data and set values. junk <- array(0, dim = c(2,3)) values <- c(10, 30, 50) junk[1

Re: [R] categorizing data

2022-05-29 Thread Janet Choate
I'm sorry if this has come across as a homework assignment!I was trying to provide a simple example. There are actually 38323 rows of data, each row is an observation of the percent that each of those veg types occupies in a spatial unit - where each line adds to 90 - and values are different every

Re: [R] categorizing data

2022-05-29 Thread Avi Gross via R-help
Tom, You may have a very different impression of what was asked! LOL! Unless Janet clarifies what seems a bit like a homework assignment, it seemsĀ to be a fairly simple and straightforward assignment with exactly three rows/columns andĀ asking how to replace the variables, in a sense, by finding

Re: [R] categorizing data

2022-05-29 Thread Rui Barradas
Hello, Here is a way. Define a function to change the values and call it in a apply loop. But Tom's suggestions are more reasonable, you should have a good reason why to change the data. x <- ' tree shrub grass 32 11 47 23 41 26 49 23 18' orig <- read.table(te

Re: [R] [External] categorizing data

2022-05-29 Thread Richard M. Heiberger
Orig <- read.table(text=" tree shrub grass 32 11 47 23 41 26 49 23 18 ", header=TRUE) New <- Orig for (i in seq(nrow(Orig))) New[i,] <- c(10, 30, 50)[order(unlist(Orig[i,]))] New > On May 29, 2022, at 15:28, Janet Choate wrote: > > Hi R community, > I have a data frame with three variables,

Re: [R] categorizing data

2022-05-29 Thread Bill Dunlap
You could write a function that deals with one row of your data, based on the order() function. E.g., > to_10_30_50 function(x) { stopifnot(is.numeric(x), length(x)==3, sum(x)==90, all(x>0)) c(10,30,50)[order(x)] } > to_10_30_50(c(23,41,26)) [1] 10 50 30 Then loop over the row

Re: [R] categorizing data

2022-05-29 Thread Tom Woolman
Some ideas: You could create a cluster model with k=3 for each of the 3 variables, to determine what constitutes high/medium/low centroid values for each of the 3 types of plant types. Centroid values could then be used as the upper/lower boundary ranges for high/med/low. Or utilize a hist

[R] How to color boxplots with respect to the variable names

2022-05-29 Thread Neha gupta
I have the following data and I need to use a boxplot which displays the variables (RF, Ranger, SVM, KNN) with one color, variables (RF_boot, Ranger_boot, SVM_boot, KNN_boot) with another color and the variables (RF_LOO, SVM_LOO, Ranger_LOO, KNN_LOO) with another color. How can I do that? Currentl

Re: [R] Use of ellipsis

2022-05-29 Thread Andreas Matre
Thank you very much Ivan and Bert! I used the eval(substitute()) workaround suggested by Ivan and it worked perfectly. Andreas Matre __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help P