Help with boxplot

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with boxplot

Tia Molte
Hi guys,
I need your help with the boxplot.
I've to create a boxplot starting from a table (.csv) in which there are the
result of a test.
Each column is a question and the rows are the answer of the respondents
(from 0 to 5).
Some answer is missing and has been filled with NA.
the table has been loaded in R with the function read.csv
I created the boxplot with the function boxplot and all work fine.
Now I have to create the boxplot with the package lattice and the function
bwplot.
when I try to use the function, R return the following error message:

> local({pkg <- select.list(sort(.packages(all.available =
> TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> class(table)
[1] "data.frame"
> bwplot(table)
Errore in UseMethod("bwplot") :
  no applicable method for 'bwplot' applied to an object of class
"data.frame"
>

Seems that some parameters are missing.
No problem if I use the function bwplot only with each single column of the
table.

thanks in advance

regards

Tia Molte

--
View this message in context: http://r.789695.n4.nabble.com/Help-with-boxplot-tp3696789p3696789.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with boxplot

Bert Gunter
Tia:

Please first read the Help file -- ?bwplot
and especially note the examples at bottom.

-- Bert

On Tue, Jul 26, 2011 at 12:39 PM, Tia Molte <[hidden email]> wrote:

> Hi guys,
> I need your help with the boxplot.
> I've to create a boxplot starting from a table (.csv) in which there are the
> result of a test.
> Each column is a question and the rows are the answer of the respondents
> (from 0 to 5).
> Some answer is missing and has been filled with NA.
> the table has been loaded in R with the function read.csv
> I created the boxplot with the function boxplot and all work fine.
> Now I have to create the boxplot with the package lattice and the function
> bwplot.
> when I try to use the function, R return the following error message:
>
>> local({pkg <- select.list(sort(.packages(all.available =
>> TRUE)),graphics=TRUE)
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
>> class(table)
> [1] "data.frame"
>> bwplot(table)
> Errore in UseMethod("bwplot") :
>  no applicable method for 'bwplot' applied to an object of class
> "data.frame"
>>
>
> Seems that some parameters are missing.
> No problem if I use the function bwplot only with each single column of the
> table.
>
> thanks in advance
>
> regards
>
> Tia Molte
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-with-boxplot-tp3696789p3696789.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>



--
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with boxplot

Tia Molte
Bert thanks.
Ok I have read the help file.
I have only a table with a series of data and not a function.
There is a way to create the correct function starting from the table?

Sorry but these are my first steps with R ...

Thanks


Tia Molte
Reply | Threaded
Open this post in threaded view
|

Re: Help with boxplot

David Winsemius

On Jul 27, 2011, at 3:17 AM, Tia Molte wrote:

> Bert thanks.
> Ok I have read the help file.
> I have only a table with a series of data and not a function.
> There is a way to create the correct function starting from the table?
>
> Sorry but these are my first steps with R ...
>

You appear to be attempting to avoid what should have been your "first  
steps with R-help... namely reading the posting guide and the rest of  
the message at the bottom of every posting.

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with boxplot

Bert Gunter
In reply to this post by Tia Molte
Tia:

R is a statistical/data analysis/graphics programming language. There
is a learning curve that you appear unwilling to climb. If I have
misjudged you, please work through the "Introduction to R" tutorial.
It will provide the information your need.  If not, install
R-Commander or another R GUI and use that. It provides quite a bit of
basic functionality that might well be sufficient for your purposes.

-- Bert

On Wed, Jul 27, 2011 at 12:17 AM, Tia Molte <[hidden email]> wrote:

> Bert thanks.
> Ok I have read the help file.
> I have only a table with a series of data and not a function.
> There is a way to create the correct function starting from the table?
>
> Sorry but these are my first steps with R ...
>
> Thanks
>
>
> Tia Molte
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-with-boxplot-tp3697194p3697756.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>



--
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with boxplot

oaxacamatt
This post was updated on .
In reply to this post by Tia Molte
Jeeeez, guys lay off.  
I think you are being a little too hard on the poor soul.  The manuals are written in computer-eez and some of the tutorials are no better.  If you can't help then don't answer.

In the meantime, Tia, I apologize.  But I suggest you try and find a 'good' (one YOU like) book or website that can help.  I particularly like 'Quick R' (google it).  The R has a lot of hidden 'switches' that can be mind blowing to the noob.
Cheers,
M
ft
Reply | Threaded
Open this post in threaded view
|

Re: Help with boxplot

ft
This post has NOT been accepted by the mailing list yet.
In reply to this post by Tia Molte
Hello Tia,

I'm sure that you've already dealt with your problem, but I experienced the same issue, and wanted to present a solution for future reference:

library("cvTools")
library('reshape2')

# $ cat data.csv
# iteration, RandomForest, Lasso, Ridge
# 1, 0.18, 0.06, 0.06
# 2, 0.15, 0.07, 0.07
# 3, 0.15,-0.04,-0.06
# 4, 0.12,0.09, 0.09
 
df <- read.csv('data.csv', header = TRUE, sep = ',')
 
# > df
#   iteration RandomForest Lasso Ridge
# 1         1         0.18  0.06  0.06
# 2         2         0.15  0.07  0.07
# 3         3         0.15 -0.04 -0.06
# 4         4         0.12  0.09  0.09
# 5         5         0.20  0.03  0.03
 
policy.cv <- melt(df[2:4])
bwplot(variable ~ value, data = df)