Hi

I usually read data from Excel this way.

open Excel file
mark values you want to copy
press Ctrl-C

type in R command window
datalist <- read.delim("clipboard")

in that case datalist shall be data.frame with probably one column so

plot(datalist[,1],type="l",ylim=c(-1,+1))

shall do what you want.

Anyway, R ships with nice manual R-Intro which is often overlooked by newbies. 
Maybe it could be emphasized during installation process or within each start 
of R, user shall be reminded from within Rprofile until he/she learns how to 
get rid of it.

Regards
Petr


From: Baro [mailto:babak...@gmail.com]
Sent: Tuesday, January 07, 2014 4:02 PM
To: PIKAL Petr
Cc: R help
Subject: Re: [R] NAs introduced by coercion warning, while plotting data

thank you for your answer, I am reading my Data from an excel File. This is my 
R code:

srow<-2421
wb <- loadWorkbook("C:\\users\\Babak\\Desktop\\spalte205.xls")
dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=srow, endRow=srow, 
startCol=spalte, endCol=spalte,header=FALSE)
datalist<-dat[,1]
datalist<-sub(";","",datalist)
datalist
plot(datalist,type="l",ylim=c(-1,+1))

as an output of my data, I see:

> datalist
[1] " 7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995, 0.0869976, 
-0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, -0.51979, 0.61944, 
-0.554766, 0.662571, -0.557779, 0.543724, -0.452397, 0.293651, -0.248438, 
0.0532787, -0.0185775, -0.176117, 0.222021, -0.34723, 0.407796, -0.416123, 
0.497159, -0.435225, 0.473375, -0.370811, 0.33683, -0.273933, 0.149871, 
-0.142623, -0.0253748, 0.0205145, -0.134123, 0.167995, -0.209844, 0.266891, 
-0.242527, 0.326598, -0.235483, 0.275738, -0.195738, 0.168225, -0.114333, 
0.0593316, -0.0583527, -0.016594, 0.0363428, -0.0533603, 0.106158, -0.129363, 
0.131993, -0.134909, 0.135686, -0.125387, 0.0866545, -0.0668686, 0.043161, 
-0.0229738  "



On Tue, Jan 7, 2014 at 6:54 AM, PIKAL Petr 
<petr.pi...@precheza.cz<mailto:petr.pi...@precheza.cz>> wrote:
Hi

I did not get any error with your data

plot(test)

dput(test)
c(7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814,
-0.51979, 0.61944, -0.554766, 0.662571, -0.557779, 0.543724,
-0.452397, 0.293651, -0.248438, 0.0532787, -0.0185775, -0.176117,
0.222021, -0.34723, 0.407796, -0.416123, 0.497159, -0.435225,
0.473375, -0.370811, 0.33683, -0.273933, 0.149871, -0.142623,
-0.0253748, 0.0205145, -0.134123, 0.167995, -0.209844, 0.266891,
-0.242527, 0.326598, -0.235483, 0.275738, -0.195738, 0.168225,
-0.114333, 0.0593316, -0.0583527, -0.016594, 0.0363428, -0.0533603,
0.106158, -0.129363, 0.131993, -0.134909, 0.135686, -0.125387,
0.0866545, -0.0668686, 0.043161, -0.0229738)

You shall explain more clearly what you did (code) and what are your data (dput)

I presume that the story is not as simple as plotting a vector as you have 
suggested.

Petr

> -----Original Message-----
> From: r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org> 
> [mailto:r-help-bounces@r-<mailto:r-help-bounces@r->
> project.org<http://project.org>] On Behalf Of Baro
> Sent: Tuesday, January 07, 2014 3:40 PM
> To: R help
> Subject: [R] NAs introduced by coercion warning, while plotting data
>
> Hi all
>
> I have such a Data and I want to plot them but I get this warning
>
> Warning message:
> In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
>
>
> " 7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
> 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, -
> 0.51979, 0.61944, -0.554766, 0.662571, -0.557779, 0.543724, -0.452397,
> 0.293651, -0.248438, 0.0532787, -0.0185775, -0.176117, 0.222021, -
> 0.34723, 0.407796, -0.416123, 0.497159, -0.435225, 0.473375, -0.370811,
> 0.33683, -0.273933, 0.149871, -0.142623, -0.0253748, 0.0205145, -
> 0.134123, 0.167995, -0.209844, 0.266891, -0.242527, 0.326598, -
> 0.235483, 0.275738, -0.195738, 0.168225, -0.114333, 0.0593316, -
> 0.0583527, -0.016594, 0.0363428, -0.0533603, 0.106158, -0.129363,
> 0.131993, -0.134909, 0.135686, -0.125387, 0.0866545, -0.0668686,
> 0.043161, -0.0229738 "
>
> Why do I get this warning? how can I solve it?
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org<mailto:R-help@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.


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to