Hi everybody, I am a newbie in R. I would like to use the panel.bpplot function on my data set but I have some problems. Can this function work on matrix? My data set have some NaN and when I run panel.bpplot function it returns error due to the presence of NaN. How Can I solve this? Thank you so much for your help netrunner -- View this message in context: http://n4.nabble.com/panel-bpplot-tp1015050p1015050.html Sent from the R help mailing list archive at Nabble.com.
netrunner wrote:> Hi everybody, > > I am a newbie in R. I would like to use the panel.bpplot function on my data > set but I have some problems. Can this function work on matrix? My data set > have some NaN and when I run panel.bpplot function it returns error due to > the presence of NaN. How Can I solve this? > > Thank you so much for your help > > netrunnerRead documentation for lattice graphics. Get your problem solved with bwplot(....) without panel=panel.bpplot then add the panel=. Frank -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University
netrunner wrote:> > I am a newbie in R. I would like to use the panel.bpplot function on my > data set but I have some problems. Can this function work on matrix? My > data set have some NaN and when I run panel.bpplot function it returns > error due to the presence of NaN. How Can I solve this? > >You should never use panel.bpplot directly, but rather in a bwplot() function. See the examples coming with the documentation in package Hmisc. Used correctly, it has no problem with NA. In general, one would use it with a data.frame, because grouping is often a factor. If this does not solve your problem, please repost with a modification of the sample below that shows the problem. Dieter library(Hmisc) set.seed(13) data = data.frame(x =rnorm(1000), g <- sample(1:6, 1000, replace=TRUE)) bwplot(g ~ x, panel=panel.bpplot, data=data) # Add NA data$x[1:3] = NA data$x[data$g==6] = NA bwplot(g ~ x, panel=panel.bpplot, data=data) -- View this message in context: http://n4.nabble.com/panel-bpplot-tp1015050p1015105.html Sent from the R help mailing list archive at Nabble.com.
Dear Dieter, thank you so much for your help. I have a question yet, sorry. I have as "x" variable a matrix (14 row,8 columns) containing the numerical ratings of a group of users. I cannot use bwplot in this case. How can do it? thank you so much netrunner Dieter Menne wrote:> > > > netrunner wrote: >> >> I am a newbie in R. I would like to use the panel.bpplot function on my >> data set but I have some problems. Can this function work on matrix? My >> data set have some NaN and when I run panel.bpplot function it returns >> error due to the presence of NaN. How Can I solve this? >> >> > > You should never use panel.bpplot directly, but rather in a bwplot() > function. See the examples coming with the documentation in package Hmisc. > Used correctly, it has no problem with NA. In general, one would use it > with a data.frame, because grouping is often a factor. > > If this does not solve your problem, please repost with a modification of > the sample below that shows the problem. > > Dieter > > > library(Hmisc) > set.seed(13) > data = data.frame(x =rnorm(1000), g <- sample(1:6, 1000, replace=TRUE)) > bwplot(g ~ x, panel=panel.bpplot, data=data) > # Add NA > data$x[1:3] = NA > data$x[data$g==6] = NA > bwplot(g ~ x, panel=panel.bpplot, data=data) > >-- View this message in context: http://n4.nabble.com/panel-bpplot-tp1015050p1016552.html Sent from the R help mailing list archive at Nabble.com.
You ignored my posting about getting Lattice to work for you (bwplot( ... )) before trying to add panel=panel.bpplot to the command. Once you learn how to use lattice you will be able to answer your own question. One of the things you will find out is that only a few lattice functions handle matrices. Frank netrunner wrote:> Dear Dieter, > thank you so much for your help. I have a question yet, sorry. I have as "x" > variable a matrix (14 row,8 columns) containing the numerical ratings of a > group of users. I cannot use bwplot in this case. How can do it? > > > thank you so much > > netrunner > > > > > > Dieter Menne wrote: >> >> >> netrunner wrote: >>> I am a newbie in R. I would like to use the panel.bpplot function on my >>> data set but I have some problems. Can this function work on matrix? My >>> data set have some NaN and when I run panel.bpplot function it returns >>> error due to the presence of NaN. How Can I solve this? >>> >>> >> You should never use panel.bpplot directly, but rather in a bwplot() >> function. See the examples coming with the documentation in package Hmisc. >> Used correctly, it has no problem with NA. In general, one would use it >> with a data.frame, because grouping is often a factor. >> >> If this does not solve your problem, please repost with a modification of >> the sample below that shows the problem. >> >> Dieter >> >> >> library(Hmisc) >> set.seed(13) >> data = data.frame(x =rnorm(1000), g <- sample(1:6, 1000, replace=TRUE)) >> bwplot(g ~ x, panel=panel.bpplot, data=data) >> # Add NA >> data$x[1:3] = NA >> data$x[data$g==6] = NA >> bwplot(g ~ x, panel=panel.bpplot, data=data) >> >> >-- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University
Ok, thank you so much! netrunner Frank E Harrell Jr wrote:> > You ignored my posting about getting Lattice to work for you (bwplot( > ... )) before trying to add panel=panel.bpplot to the command. Once you > learn how to use lattice you will be able to answer your own question. > One of the things you will find out is that only a few lattice functions > handle matrices. > > Frank > > > netrunner wrote: >> Dear Dieter, >> thank you so much for your help. I have a question yet, sorry. I have as >> "x" >> variable a matrix (14 row,8 columns) containing the numerical ratings of >> a >> group of users. I cannot use bwplot in this case. How can do it? >> >> >> thank you so much >> >> netrunner >> >> >> >> >> >> Dieter Menne wrote: >>> >>> >>> netrunner wrote: >>>> I am a newbie in R. I would like to use the panel.bpplot function on my >>>> data set but I have some problems. Can this function work on matrix? My >>>> data set have some NaN and when I run panel.bpplot function it returns >>>> error due to the presence of NaN. How Can I solve this? >>>> >>>> >>> You should never use panel.bpplot directly, but rather in a bwplot() >>> function. See the examples coming with the documentation in package >>> Hmisc. >>> Used correctly, it has no problem with NA. In general, one would use it >>> with a data.frame, because grouping is often a factor. >>> >>> If this does not solve your problem, please repost with a modification >>> of >>> the sample below that shows the problem. >>> >>> Dieter >>> >>> >>> library(Hmisc) >>> set.seed(13) >>> data = data.frame(x =rnorm(1000), g <- sample(1:6, 1000, replace=TRUE)) >>> bwplot(g ~ x, panel=panel.bpplot, data=data) >>> # Add NA >>> data$x[1:3] = NA >>> data$x[data$g==6] = NA >>> bwplot(g ~ x, panel=panel.bpplot, data=data) >>> >>> >> > > > -- > Frank E Harrell Jr Professor and Chairman School of Medicine > Department of Biostatistics Vanderbilt University > > ______________________________________________ > 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. > >-- View this message in context: http://n4.nabble.com/panel-bpplot-tp1015050p1016650.html Sent from the R help mailing list archive at Nabble.com.
Possibly Parallel Threads
- A two-part question about box-percentile plots, bpplot(): (1) yaxt="n" doesn't seem to work (2) how to display mean values
- Lattice box percentile plot
- annotating an axis in bwplot (lattice)
- bwplot: how not to draw outliers
- Impaired boxplot functionality - mean instead of median