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
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
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
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
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,
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<
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.
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
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
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
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
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,
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
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
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
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
16 matches
Mail list logo