Marna Wagley
2022-Jan-17 07:05 UTC
[R] How to convert category (or range/group) into continuous ?
Hi R users, I first categorized the continuous data into groups (ranges or category) but now I would like to change the category into a continuous data and plot it. For example I have attached the data in which you can see two columns named "group" and "value". The group column contains a range (group, for example ), I am wondering how I can change the category data (for example: "0,0.01]" )into continuous data with a 0.1 interval. Thank you for your suggestions. daT<-structure(list(group = c("(0,0.01]", "(0.01,0.025]", "(0.025,0.05]", "(0.05,0.075]", "(0.075,0.1]", "(0.1,0.2]", "(0.2,0.3]", "(0.3,0.4]", "(0.4,0.5]", "(0.5,0.6]", "(0.6,0.7]", "(0.7,0.8]", "(0.8,0.9]", "(0.9,1]", "(1,1.1]", "(1.1,1.5]", "(1.5,2]", "(2,2.5]"), VALUE = c(1, 1, 1, 1, 1, 1, 0.944444444, 0.916666667, 0.888888889, 0.857777778, 0.826666667, 0.66, 0.439090909, 0.328636364, 0.273409091, 0.245795455, 0.218181818, 0.084848485)), class = "data.frame", row.names = c(NA, -18L)) thanks, MW [[alternative HTML version deleted]]
Bert Gunter
2022-Jan-17 15:34 UTC
[R] How to convert category (or range/group) into continuous ?
IMO, this is a bad idea. You are asking how to fabricate information that isn't there. You lost the information when you created the categories. Why can you not just go back to your original data? Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Jan 16, 2022 at 11:06 PM Marna Wagley <marna.wagley at gmail.com> wrote:> Hi R users, > I first categorized the continuous data into groups (ranges or category) > but now I would like to change the category into a continuous data and > plot it. For example I have attached the data in which you can see two > columns named "group" and "value". The group column contains a range > (group, for example ), I am wondering how I can change the category data > (for example: "0,0.01]" )into continuous data with a 0.1 interval. > Thank you for your suggestions. > > daT<-structure(list(group = c("(0,0.01]", "(0.01,0.025]", "(0.025,0.05]", > "(0.05,0.075]", "(0.075,0.1]", "(0.1,0.2]", "(0.2,0.3]", "(0.3,0.4]", > "(0.4,0.5]", "(0.5,0.6]", "(0.6,0.7]", "(0.7,0.8]", "(0.8,0.9]", > "(0.9,1]", "(1,1.1]", "(1.1,1.5]", "(1.5,2]", "(2,2.5]"), VALUE = c(1, > 1, 1, 1, 1, 1, 0.944444444, 0.916666667, 0.888888889, 0.857777778, > 0.826666667, 0.66, 0.439090909, 0.328636364, 0.273409091, 0.245795455, > 0.218181818, 0.084848485)), class = "data.frame", row.names = c(NA, > -18L)) > thanks, > MW > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]