[R] RES: RES: Plot

Rodrigo Aluizio r.aluizio at gmail.com
Tue Oct 6 17:17:35 CEST 2009


Oh yeah, I forgot that, just correct this by:

Data<-as.data.frame(matrix(c("Monday", "Tuesday", "Wed", "Thu",
"Fri","Sat","Sun",56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,l
ist(paste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F))
Data$Hum<-as.numeric(Data$Hum)
Data$Temp<-as.numeric(Data$Temp)

Then you can plot it.

-----Mensagem original-----
De: joris meys [mailto:jorismeys at gmail.com] 
Enviada em: terça-feira, 6 de outubro de 2009 12:08
Para: Rodrigo Aluizio
Assunto: Re: [R] RES: Plot

On Tue, Oct 6, 2009 at 4:56 PM, Rodrigo Aluizio <r.aluizio at gmail.com> wrote:
> This may work for you.
> Then you can custom your graphics with ?par.
>
> Data<-as.data.frame(matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri",
>
"Sat","Sun",56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,list(pa
> ste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F))
This won't work, as it puts also Temp en Hum as factors. A matrix can
only have 1 mode, and the matrix call you do converts everything to
factor before you put it in the dataframe.

>
> plot(Data$Days,Data$Temp)
>
> -----Mensagem original-----
> De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Em
> nome de Ashta
> Enviada em: terça-feira, 6 de outubro de 2009 11:36
> Para: Sarah Goslee
> Cc: R help
> Assunto: Re: [R] Plot
>
> Thanks Sara,
>
> Yes I did try. I could not get the Days on the X-axis
>
> blow is theerror message
>
> plot(Temp,Days)
> Error in plot.window(...) : need finite 'ylim' values
> In addition: Warning messages:
> 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
> 2: In min(x) : no non-missing arguments to min; returning Inf
> 3: In max(x) : no non-missing arguments to max; returning -Inf
>>
>
>
>
> On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee
<sarah.goslee at gmail.com>wrote:
>
>> Did you try it? With, perhaps, plot() ? And lines() ?
>>
>> You might do better with Days as a factor with the day names in order.
> (And
>> why are two full and five abbreviated?)
>>
>> I don't understand why Hum and Temp are matrices rather than vectors,
>> and why then you didn't specify dimensions, and for that matter why you
>> are missing a closing paren but do have a comma in its place.
>>
>> Generally this list is happy to help, but we like some evidence that the
>> querent has *tried* before inquiring.
>>
>> Sarah
>>
>> On Tue, Oct 6, 2009 at 10:05 AM, Ashta <sewashm at gmail.com> wrote:
>> > Hi All,
>> >
>> >
>> > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat",
>> > "Sun"),7,1)
>> >
>> > Hum <-matrix(c(56,57,60,75,62,67,70),
>> >
>> > Temp<-matrix(c(76,77,81,95,82,77,83),
>> >
>> >
>> >
>> > Using the above information I want plot humidity and temperature on
>> Y-axis
>> > and days on X-axis
>> >
>> > Any help is appreciated!
>> >
>>
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list