[R] how to plot the spectrum by log-log axis

2014-01-07 Thread Jie Tang
hi
I have a wind dataset and I want to analze its spectrum with
the x-axis and y-axis in log .But I found that
when I set log=dB in spectrum as shown below,what I can get
is a figure by log y-axis.
How could I get a log-axis figure both in x-axis and y-axis ?
thank you .

yylab-c(Wind Spectrum(db) )
YY=c(-40,40)
spectrum(ww_spec,log = dB,ylim=YY,main=maininfo,ylab=yylab)

-- 
TANG Jie

[[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.


Re: [R] how to plot the spectrum by log-log axis

2014-01-07 Thread Jie Tang
Futher more

When I write as below :,the result is still not satisfied .
 asp=spectrum(ww_spec)
 windspec=data.frame(asp)
 plot(windspec,log=dB)


2014/1/7 Jie Tang totang...@gmail.com

 hi
 I have a wind dataset and I want to analze its spectrum with
 the x-axis and y-axis in log .But I found that
 when I set log=dB in spectrum as shown below,what I can get
 is a figure by log y-axis.
 How could I get a log-axis figure both in x-axis and y-axis ?
 thank you .

 yylab-c(Wind Spectrum(db) )
 YY=c(-40,40)
 spectrum(ww_spec,log = dB,ylim=YY,main=maininfo,ylab=yylab)

 --
 TANG Jie




-- 
TANG Jie
Email: totang...@gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China

[[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.


Re: [R] help

2014-01-07 Thread PIKAL Petr
Hi

and what is wrong with e.g.

fit  - neuralnet(pH~station+month, data=yourdata)

As I said I am not an expert in neural nets  but here is some explanation how 
it works
http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/

based on that after fitting you could do

compute(fit, testdata)

where testdata shall be station and month.

However for time series it can be more appropriate something like ARIMA 
modelling.

Petr

From: javad bayat [mailto:j.bayat...@gmail.com]
Sent: Monday, January 06, 2014 5:58 PM
To: PIKAL Petr
Subject: Re: [R] help

Dear Petr;
I want to write function that: for example for pH:
according these 20 months predict the variability of pH for next month and 
stations.
all best.

On Mon, Jan 6, 2014 at 7:23 PM, PIKAL Petr 
petr.pi...@precheza.czmailto:petr.pi...@precheza.cz wrote:
Hi
can you be more specific? In what aspect those packages does not comply with 
your data? What did you do for testing it?

I am not an expert in neural networks but I do not see anything which prevents 
using your data in nnet.

Petr


 -Original Message-
 From: r-help-boun...@r-project.orgmailto:r-help-boun...@r-project.org 
 [mailto:r-help-bounces@r-mailto:r-help-bounces@r-
 project.orghttp://project.org] On Behalf Of javad bayat
 Sent: Monday, January 06, 2014 3:16 PM
 To: R-help@r-project.orgmailto:R-help@r-project.org
 Subject: Re: [R] help

 Dear Petr;
 I saw the nnet and neuralnet packag, and I cant find some thing
 relating with my data based on neural network.


 On Mon, Jan 6, 2014 at 10:55 AM, PIKAL Petr 
 petr.pi...@precheza.czmailto:petr.pi...@precheza.cz
 wrote:

  Hi
 
  Why you did not use dput for sending data? It is far better than
  picture, which can not be used without retyping.
 
  Redarding neural network, did you try e.g. nnet or neuralnet package.
 
  Petr
 
   -Original Message-
   From: r-help-boun...@r-project.orgmailto:r-help-boun...@r-project.org 
   [mailto:r-help-bounces@r-mailto:r-help-bounces@r-
   project.orghttp://project.org] On Behalf Of javad bayat
   Sent: Monday, January 06, 2014 7:37 AM
   To: R-help@r-project.orgmailto:R-help@r-project.org
   Subject: Re: [R] help
  
   Dear all;
   many thanks for your answers.
   Hear is my data (not all row: the station was 8 station at 20
 month)
   which I forward it as image. I hope some one can help me to do
   Neural network for prediction of next month.
   many thanks.
   all bests.
  
  
  
  
  
  
   --
   Best Regards
   Javad Bayat
   M.Sc. Environment Engineering
   Shahid Beheshti (National) University (SBU) Alternative Mail:
   bayat...@yahoo.commailto:bayat...@yahoo.com
 



 --
 Best Regards
 Javad Bayat
 M.Sc. Environment Engineering
 Shahid Beheshti (National) University (SBU) Alternative Mail:
 bayat...@yahoo.commailto:bayat...@yahoo.com

   [[alternative HTML version deleted]]

 __
 R-help@r-project.orgmailto: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.



--
Best Regards
Javad Bayat
M.Sc. Environment Engineering
Shahid Beheshti (National) University (SBU)
Alternative Mail: bayat...@yahoo.commailto:bayat...@yahoo.com

[[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.


Re: [R] how to plot the spectrum by log-log axis

2014-01-07 Thread Jie Tang
I use

windlog=log10(windspec)
plot(windlog)
it seems good but stupid

is there any better method ?




2014/1/7 Jie Tang totang...@gmail.com

 Futher more

 When I write as below :,the result is still not satisfied .
  asp=spectrum(ww_spec)
  windspec=data.frame(asp)
  plot(windspec,log=dB)


 2014/1/7 Jie Tang totang...@gmail.com

 hi
 I have a wind dataset and I want to analze its spectrum with
 the x-axis and y-axis in log .But I found that
 when I set log=dB in spectrum as shown below,what I can get
 is a figure by log y-axis.
 How could I get a log-axis figure both in x-axis and y-axis ?
 thank you .

 yylab-c(Wind Spectrum(db) )
 YY=c(-40,40)
 spectrum(ww_spec,log = dB,ylim=YY,main=maininfo,ylab=yylab)

 --
 TANG Jie




 --
 TANG Jie
 Email: totang...@gmail.com
 Tel: 0086-2154896104
 Shanghai Typhoon Institute,China




-- 
TANG Jie
Email: totang...@gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China

[[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.


Re: [R] help

2014-01-07 Thread Frede Aakmann Tøgersen
Dear Javad Bayat

I think that people on this list has been most helpful to your with your 
questions about how to use neural networks in R. 

Now you have come to the point where you need a more statistical understanding 
of your data before you can decide whether neural network methods is really the 
best way for you to do forecasting. Let me illustrate that. 

I'm doing this in R.

### Rscript start 

## import your data
bayat - read.table(bayat.txt, h = TRUE)

## attach the neuralnet package
library(neuralnet)

## fit a simple model
fit  - neuralnet(pH ~ station + month, data = bayat)

## create new data into the future
futuredata - expand.grid(station = 1:8, month = 21:25)

## do predictions
predictions - compute(fit, futuredata)
predictions - data.frame(predictions[[neurons]][[1]][,2:3], pH = 
predictions$net.result)

head(predictions)
  station month  pH
1   121 8.294072681
2   221 8.294072683
3   321 8.294072684
4   421 8.294072685
5   521 8.294072685
6   621 8.294072686

## plot the results together with original data
library(lattice)
library(latticeExtra)

xyplot(pH ~ month|factor(station), data = bayat, type = b, layout = c(4,2), 
xlim = c(0:26))+
xyplot(pH ~ month|factor(station), data = predictions, type = b, layout = 
c(4,2), col = red)

## calculate mean pH for each station
aggregate(list(pH = bayat$pH), by = list(station = bayat$station), mean)
  station pH
1   1 8.3215
2   2 8.4640
3   3 8.2890
4   4 8.2100
5   5 8.3240
6   6 8.4575
7   7 8.2085
8   8 8.0645

## overall mean of pH
mean(bayat$pH)
[1] 8.292375

### Rscript end ###

Here is my comment to the results.

I have attached the plot as a png file (hope it makes its way to the list). The 
blue curve is the original data and red curve is the predictions into the 
future. As you can see the levels of pH is somewhat constant during the 
measurement periods. The deviations from constant levels may be due solely to 
measurement errors. 

As you can see from the figure that using the fitted simple neural network to 
forecast is not that good. It seem that the neural network forecast the value 
of pH to be the overall mean for all stations.

Your're a master student so I would strongly suggest that you consider the 
following points together with your supervisor.

1. Make plots of your data(all responses) to see how your data behave and show 
the plots to your supervisor.
2. Discuss with your supervisor what kind of underlying processes  the data 
comes from. Then you can probably make some assumptions on some cyclic behavior 
of the data such as a seasonal variation (as month = 1:20 this variable does 
not define any seasonality).
3.  Is neural network really the method to use here? Discuss with your 
supervisor whether there could be other methods from theory on time series 
analysis that could be useful.
4. Have a look at the Task Views at CRAN 
(http://cran.r-project.org/web/views/): see e.g. TimeSeries, MachineLearning, 
Environmetrics, Econometrics, Finance.


I do not have time to help you further. If you have further questions please 
contact your supervisor.


Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance  Modeling

Technology  Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of PIKAL Petr
 Sent: 7. januar 2014 09:01
 To: javad bayat
 Cc: R-help@r-project.org
 Subject: Re: [R] help
 
 Hi
 
 and what is wrong with e.g.
 
 fit  - neuralnet(pH~station+month, data=yourdata)
 
 As I said I am not an expert in neural nets  but here is some explanation how
 it works
 http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-
 example/
 
 based on that after fitting you could do
 
 compute(fit, testdata)
 
 where testdata shall be station and month.
 
 However for time series it can be more appropriate something like ARIMA
 modelling.
 
 Petr
 
 From: javad bayat [mailto:j.bayat...@gmail.com]
 Sent: Monday, January 06, 2014 5:58 PM
 To: PIKAL Petr
 Subject: Re: [R] help
 
 Dear Petr;
 I want to write function that: for example for pH:
 according these 20 months predict the variability of pH for next month and
 stations.
 all best.
 
 On Mon, Jan 6, 2014 at 7:23 PM, PIKAL Petr
 petr.pi...@precheza.czmailto:petr.pi...@precheza.cz wrote:
 Hi
 can you be more specific? In what aspect those packages does not comply
 with your data? What did you do for testing it?
 
 I am not an expert in neural networks but I do not see anything which
 prevents using your data in nnet.
 
 Petr
 
 
  -Original Message-
  From: 

[R] The R Journal, Volume 5, Issue 2

2014-01-07 Thread Hadley Wickham
Dear all,

The latest issue of The R Journal is now available at
http://journal.r-project.org/archive/2013-2/

Many thanks to all contributors.

Hadley

--
Editor-in-chief, The R Journal

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
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.


[R] How do I perform conditional annotation of lattice panel plots?

2014-01-07 Thread Chen, George
My apologies for asking this question that may have been asked before. I am 
trying to plot activity dependent on time conditioned by the subject. Code for 
sample data below.

So I have something like this

xyplot(Activity~Time|Subject).
This works fine, but now I want to show where on these activity curves Event A 
occurs. This is to explore the relationship between A and activity.

I tried this:

xyplot(EventA+Activity~Time|Subject)

but then the numerical ordering gets out of order.
Ideally Event A could be denoted by a vertical line cutting through the curve 
at the day Event A occurred, but some other way to denote it would be great!

Here is my sample data as R code:

Subject-c(1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4)
Day-c(1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6)
Activity-c(2,3,4,3,7,4,5,8,2,8,4,6,2,5,3,8,9,5,6,3,4,5,6,7)
EventA-c(Yes,NA,Yes,NA,NA,NA,Yes,NA,NA,NA,NA,NA,
  Yes,NA,NA,NA,NA,NA,NA,NA,Yes,NA,NA,NA)
Data-data.frame(cbind(Subject,Day,Activity,EventA))

  Subject Day Activity EventA
11   12Yes
21   23   NA
31   34Yes
41   43   NA
51   57   NA
61   64   NA
72   15Yes
82   28   NA
92   32   NA
10   2   48   NA
11   2   54   NA
12   2   66   NA
13   3   12Yes
14   3   25   NA
15   3   33   NA
16   3   48   NA
17   3   59   NA
18   3   65   NA
19   4   16   NA
20   4   23   NA
21   4   34Yes
22   4   45   NA
23   4   56   NA
24   4   67   NA
Any ideas on how to do this would be appreciated!

Thanks very much in advance!


This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or use of this email message is prohibited.  If you have received 
this message in error, please notify the sender immediately by e-mail and 
delete this email message from your computer. Thank you.
[[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.


[R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
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 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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread PIKAL Petr
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-bounces@r-
 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 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@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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
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 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-bounces@r-
  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 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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread jim holtman
From your output, it looks like 'datalist' is a character string and
not a numeric vector as you expect.  Try doing:

str(datalist)

to see the structure and to use

dput(datalist)

to post the data.

Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Tue, Jan 7, 2014 at 10:01 AM, Baro babak...@gmail.com wrote:
 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 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-bounces@r-
  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 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.

__
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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
Thank you sir:

If I am tying
str(datalist)

I have this output

chr  7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, |
__truncated__


and if I try:
dput(datalist)

I have:

 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 7:11 AM, jim holtman jholt...@gmail.com wrote:

 From your output, it looks like 'datalist' is a character string and
 not a numeric vector as you expect.  Try doing:

 str(datalist)

 to see the structure and to use

 dput(datalist)

 to post the data.

 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?
 Tell me what you want to do, not how you want to do it.


 On Tue, Jan 7, 2014 at 10:01 AM, Baro babak...@gmail.com wrote:
  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
 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-bounces@r-
   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 mailing list
   

Re: [R] help

2014-01-07 Thread javad bayat
I apologies for asking this question;
I run the codes but why all the prediction for pH in 21-25 month are so
close?
 station month  pH
  1   21  8.275635958
  2   21  8.275635962
  3   21  8.275635963
  4   21  8.275635963
  5   21  8.275635963
  6   21  8.275635963



On Tue, Jan 7, 2014 at 2:12 PM, javad bayat j.bayat...@gmail.com wrote:

 Dear Pikal Petr;
 thanks for code.
 It was usefull.



 On Tue, Jan 7, 2014 at 11:30 AM, PIKAL Petr petr.pi...@precheza.czwrote:

  Hi



 and what is wrong with e.g.



 fit  - neuralnet(pH~station+month, data=yourdata)



 As I said I am not an expert in neural nets  but here is some explanation
 how it works

 http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example/



 based on that after fitting you could do



 compute(fit, testdata)



 where testdata shall be station and month.



 However for time series it can be more appropriate something like ARIMA
 modelling.



 Petr



 *From:* javad bayat [mailto:j.bayat...@gmail.com]
 *Sent:* Monday, January 06, 2014 5:58 PM
 *To:* PIKAL Petr
 *Subject:* Re: [R] help



 Dear Petr;

 I want to write function that: for example for pH:

 according these 20 months predict the variability of pH for next month
 and stations.

 all best.



 On Mon, Jan 6, 2014 at 7:23 PM, PIKAL Petr petr.pi...@precheza.cz
 wrote:

 Hi
 can you be more specific? In what aspect those packages does not comply
 with your data? What did you do for testing it?

 I am not an expert in neural networks but I do not see anything which
 prevents using your data in nnet.


 Petr


  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org] On Behalf Of javad bayat

  Sent: Monday, January 06, 2014 3:16 PM
  To: R-help@r-project.org
  Subject: Re: [R] help
 

  Dear Petr;

  I saw the nnet and neuralnet packag, and I cant find some thing
  relating with my data based on neural network.
 
 
  On Mon, Jan 6, 2014 at 10:55 AM, PIKAL Petr petr.pi...@precheza.cz
  wrote:
 
   Hi
  
   Why you did not use dput for sending data? It is far better than
   picture, which can not be used without retyping.
  
   Redarding neural network, did you try e.g. nnet or neuralnet package.
  
   Petr
  
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of javad bayat
Sent: Monday, January 06, 2014 7:37 AM
To: R-help@r-project.org
Subject: Re: [R] help
   
Dear all;
many thanks for your answers.
Hear is my data (not all row: the station was 8 station at 20
  month)
which I forward it as image. I hope some one can help me to do
Neural network for prediction of next month.
many thanks.
all bests.
   
   
   
   
   
   
--
Best Regards
Javad Bayat
M.Sc. Environment Engineering
Shahid Beheshti (National) University (SBU) Alternative Mail:
bayat...@yahoo.com
  
 
 
 
  --
  Best Regards
  Javad Bayat
  M.Sc. Environment Engineering
  Shahid Beheshti (National) University (SBU) Alternative Mail:
  bayat...@yahoo.com
 

[[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.





 --

 Best Regards
 Javad Bayat
 M.Sc. Environment Engineering
 Shahid Beheshti (National) University (SBU)
 Alternative Mail: bayat...@yahoo.com




 --
 Best Regards
 Javad Bayat
 M.Sc. Environment Engineering
 Shahid Beheshti (National) University (SBU)
 Alternative Mail: bayat...@yahoo.com




-- 
Best Regards
Javad Bayat
M.Sc. Environment Engineering
Shahid Beheshti (National) University (SBU)
Alternative Mail: bayat...@yahoo.com

[[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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
I am reading only one Cell of Excel


On Tue, Jan 7, 2014 at 7:18 AM, Dániel Kehl ke...@ktk.pte.hu wrote:

 Hi,

 are you reading only one cell of your Excel file?
 It seems your datalist is not numeric but text.
 Try saving your Excel file as csv or text, reading in data might be much
 more straightforward!

 best
 daniel
 
 Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
 meghatalmaz#243;: Baro [babak...@gmail.com]
 Küldve: 2014. január 7. 16:01
 To: PIKAL Petr
 Cc: R help
 Tárgy: 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 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-bounces@r-
   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 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.


[[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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Dániel Kehl
Hi,

are you reading only one cell of your Excel file?
It seems your datalist is not numeric but text.
Try saving your Excel file as csv or text, reading in data might be much more 
straightforward!

best
daniel

Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; 
meghatalmaz#243;: Baro [babak...@gmail.com]
Küldve: 2014. január 7. 16:01
To: PIKAL Petr
Cc: R help
Tárgy: 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 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-bounces@r-
  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 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.

__
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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread jim holtman
You may want to understand how your data is coming out of Excel.  You
are getting just a single character string.  Here is code to convert
the string to numerics and plot:

x -  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 ; 
# remove commas and semicolons for reading
x - gsub(,|;, '', x)
# read in the data
xin - scan(text = x, what = 0)

plot(xin)

Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Tue, Jan 7, 2014 at 10:15 AM, Baro babak...@gmail.com wrote:
 Thank you sir:

 If I am tying
 str(datalist)

 I have this output

 chr  7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
 0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, |
 __truncated__


 and if I try:
 dput(datalist)

 I have:

  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 7:11 AM, jim holtman jholt...@gmail.com wrote:

 From your output, it looks like 'datalist' is a character string and
 not a numeric vector as you expect.  Try doing:

 str(datalist)

 to see the structure and to use

 dput(datalist)

 to post the data.

 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?
 Tell me what you want to do, not how you want to do it.


 On Tue, Jan 7, 2014 at 10:01 AM, Baro babak...@gmail.com wrote:
  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
  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-bounces@r-
   project.org] On Behalf Of Baro
   Sent: 

Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread PIKAL Petr
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.czmailto: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.orgmailto:r-help-boun...@r-project.org 
 [mailto:r-help-bounces@r-mailto:r-help-bounces@r-
 project.orghttp://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.orgmailto: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.


Re: [R] NAs introduced by coercion warning, while plotting data

2014-01-07 Thread Baro
thank you sir, it works


On Tue, Jan 7, 2014 at 7:27 AM, jim holtman jholt...@gmail.com wrote:

 You may want to understand how your data is coming out of Excel.  You
 are getting just a single character string.  Here is code to convert
 the string to numerics and plot:

 x -  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 ; 
 # remove commas and semicolons for reading
 x - gsub(,|;, '', x)
 # read in the data
 xin - scan(text = x, what = 0)

 plot(xin)

 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?
 Tell me what you want to do, not how you want to do it.


 On Tue, Jan 7, 2014 at 10:15 AM, Baro babak...@gmail.com wrote:
  Thank you sir:
 
  If I am tying
  str(datalist)
 
  I have this output
 
  chr  7.0121, -0.673354, 0.749622, -0.549641, 0.435662, -0.328995,
  0.0869976, -0.0851428, -0.191019, 0.188799, -0.373707, 0.434814, |
  __truncated__
 
 
  and if I try:
  dput(datalist)
 
  I have:
 
   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 7:11 AM, jim holtman jholt...@gmail.com wrote:
 
  From your output, it looks like 'datalist' is a character string and
  not a numeric vector as you expect.  Try doing:
 
  str(datalist)
 
  to see the structure and to use
 
  dput(datalist)
 
  to post the data.
 
  Jim Holtman
  Data Munger Guru
 
  What is the problem that you are trying to solve?
  Tell me what you want to do, not how you want to do it.
 
 
  On Tue, Jan 7, 2014 at 10:01 AM, Baro babak...@gmail.com wrote:
   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
   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 

Re: [R] help

2014-01-07 Thread PIKAL Petr
Hi

You have got an extensive explanation by Frede Aakmann Tøgersen. I consider it 
pretty strightforward and I do not have anything to add.

Do not expect that somebody can change your result, if your data does not 
support it.

Regards
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of javad bayat
 Sent: Tuesday, January 07, 2014 4:24 PM
 To: R-help@r-project.org
 Subject: Re: [R] help
 
 I apologies for asking this question;
 I run the codes but why all the prediction for pH in 21-25 month are so
 close?
  station month  pH
   1   21  8.275635958
   2   21  8.275635962
   3   21  8.275635963
   4   21  8.275635963
   5   21  8.275635963
   6   21  8.275635963
 
 
 
 On Tue, Jan 7, 2014 at 2:12 PM, javad bayat j.bayat...@gmail.com
 wrote:
 
  Dear Pikal Petr;
  thanks for code.
  It was usefull.
 
 
 
  On Tue, Jan 7, 2014 at 11:30 AM, PIKAL Petr
 petr.pi...@precheza.czwrote:
 
   Hi
 
 
 
  and what is wrong with e.g.
 
 
 
  fit  - neuralnet(pH~station+month, data=yourdata)
 
 
 
  As I said I am not an expert in neural nets  but here is some
  explanation how it works
 
  http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-
 exampl
  e/
 
 
 
  based on that after fitting you could do
 
 
 
  compute(fit, testdata)
 
 
 
  where testdata shall be station and month.
 
 
 
  However for time series it can be more appropriate something like
  ARIMA modelling.
 
 
 
  Petr
 
 
 
  *From:* javad bayat [mailto:j.bayat...@gmail.com]
  *Sent:* Monday, January 06, 2014 5:58 PM
  *To:* PIKAL Petr
  *Subject:* Re: [R] help
 
 
 
  Dear Petr;
 
  I want to write function that: for example for pH:
 
  according these 20 months predict the variability of pH for next
  month and stations.
 
  all best.
 
 
 
  On Mon, Jan 6, 2014 at 7:23 PM, PIKAL Petr petr.pi...@precheza.cz
  wrote:
 
  Hi
  can you be more specific? In what aspect those packages does not
  comply with your data? What did you do for testing it?
 
  I am not an expert in neural networks but I do not see anything
 which
  prevents using your data in nnet.
 
 
  Petr
 
 
   -Original Message-
   From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
   project.org] On Behalf Of javad bayat
 
   Sent: Monday, January 06, 2014 3:16 PM
   To: R-help@r-project.org
   Subject: Re: [R] help
  
 
   Dear Petr;
 
   I saw the nnet and neuralnet packag, and I cant find some thing
   relating with my data based on neural network.
  
  
   On Mon, Jan 6, 2014 at 10:55 AM, PIKAL Petr
   petr.pi...@precheza.cz
   wrote:
  
Hi
   
Why you did not use dput for sending data? It is far better than
picture, which can not be used without retyping.
   
Redarding neural network, did you try e.g. nnet or neuralnet
 package.
   
Petr
   
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of javad bayat
 Sent: Monday, January 06, 2014 7:37 AM
 To: R-help@r-project.org
 Subject: Re: [R] help

 Dear all;
 many thanks for your answers.
 Hear is my data (not all row: the station was 8 station at 20
   month)
 which I forward it as image. I hope some one can help me to do
 Neural network for prediction of next month.
 many thanks.
 all bests.






 --
 Best Regards
 Javad Bayat
 M.Sc. Environment Engineering
 Shahid Beheshti (National) University (SBU) Alternative Mail:
 bayat...@yahoo.com
   
  
  
  
   --
   Best Regards
   Javad Bayat
   M.Sc. Environment Engineering
   Shahid Beheshti (National) University (SBU) Alternative Mail:
   bayat...@yahoo.com
  
 
 [[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.
 
 
 
 
 
  --
 
  Best Regards
  Javad Bayat
  M.Sc. Environment Engineering
  Shahid Beheshti (National) University (SBU) Alternative Mail:
  bayat...@yahoo.com
 
 
 
 
  --
  Best Regards
  Javad Bayat
  M.Sc. Environment Engineering
  Shahid Beheshti (National) University (SBU) Alternative Mail:
  bayat...@yahoo.com
 
 
 
 
 --
 Best Regards
 Javad Bayat
 M.Sc. Environment Engineering
 Shahid Beheshti (National) University (SBU) Alternative Mail:
 bayat...@yahoo.com
 
   [[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.

__

Re: [R] How do I perform conditional annotation of lattice panel plots?

2014-01-07 Thread Ken Knoblauch
Chen, George George.Chen at roswellpark.org writes:
 My apologies for asking this question that may have 
been asked before. I am trying to plot activity
 dependent on time conditioned by the subject. 
Code for sample data below.
 So I have something like this
 xyplot(Activity~Time|Subject).
 This works fine, but now I want to show 
where on these activity curves Event A occurs. 
This is to explore the
 relationship between A and activity.
 
 I tried this:
 
 xyplot(EventA+Activity~Time|Subject)
 
 but then the numerical ordering gets out of order.
 Ideally Event A could be denoted by a vertical line 
cutting through the curve at the day Event A occurred, but
 some other way to denote it would be great!
 
-snip -
 Any ideas on how to do this would be appreciated!
 
 Thanks very much in advance!
 
 This email message may contain legally privileged 
and/or confidential information.  If you are not the
 intended recipient(s), or the employee or agent 
responsible for the delivery of this message to the
 intended recipient(s), you are hereby notified 
that any disclosure, copying, distribution, or use of
 this email message is prohibited.  If you have 
received this message in error, please notify the sender
 immediately by e-mail and delete this email 
message from your computer. Thank you.
   [[alternative HTML version deleted]]
You used Time in your formula but Day in 
your data so I changed the formula to Day
assuming that's what you meant

Perhaps, not the most elegant solution, but 
how about something like this

library(lattice)
Subject-c(1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4)
Day-c(1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6)
Activity-c(2,3,4,3,7,4,5,8,2,8,4,6,2,5,3,8,9,5,6,3,4,5,6,7)
EventA-c(Yes,NA,Yes,NA,NA,NA,Yes,NA,NA,NA,NA,NA,
  Yes,NA,NA,NA,NA,NA,NA,NA,Yes,NA,NA,NA)
Data-data.frame(cbind(Subject,Day,Activity,EventA))

xyplot(Activity~ Day | Subject)
xyplot(Activity ~ Day | Subject, data = Data,
subscripts = TRUE,
panel = function(x, y, subscripts, ...){
panel.xyplot(x, y)
wh - Data[subscripts, ]
panel.abline(v = wh$Day[!is.na(wh$EventA)])
})


-- 
Kenneth Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html

__
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.


[R] Question regarding the package rugarch

2014-01-07 Thread Grünenfelder Corina
Dear all,
 
I have a question regarding the package rugarch. I would like to fit a garch 
model with exogenous variables using rugarch. My code is as follows, where 
data.reg is a time series object where the first column corresponds to the 
response variable and the remainder columns are the exogenous variables.  
 
spec - ugarchspec(variance.model = list(model = sGARCH, garchOrder = c(1, 1),
 submodel = NULL, external.regressors = 
NULL, variance.targeting = FALSE),
   mean.model = list(armaOrder = c(1, 1), external.regressors = 
data.reg[,-1]))
 #, distribution.model = norm, start.pars 
= list(), fixed.pars = list()))
 
garch - ugarchfit(spec=spec,data=data.reg[,1],solver.control=list(trace=0))
 
When running the second command, the following error appears:
 
Error in pars[idx[mxreg, 1]:idx[mxreg, 2], 1] = fit.mean[i] :
  replacement has length zero
 
How can I solve this problem?
 
Thanks for your help
Corina
__
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.


[R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread Pavel N. Krivitsky
Hi,

I have a list of sublists, and I want to add and/or remove elements in
each sublist in accordance with a code snippet. I had thought that an
elegant way to do that is using a combination of lapply() and within().
However, the code in the within() call doesn't seem to be able to see
objects outside of it. For (a simplified) example,

f - function(x){
  y - list(y1=list())
  y - lapply(y, within, {z-x})
  y
}
f(1)

My understanding is that what should happen is that lapply() would
execute

within(y[[y1]], {z-x}),

with 1 substituted for x, within() would notice that z has been assigned
1, returning list(z=1), which then gets put into a list as element named
y1, so the function should ultimately return

list(y1=list(z=1))

What I get instead (on R 3.0.2 and current trunk, both on Linux) is

Error in eval(expr, envir, enclos) : object 'x' not found

Am I doing something wrong, or is this a bug?

   Thanks in advance,
   Pavel

P.S. If I hard-code the value for x, i.e.,

f - function(){
  y - list(y1=list())
  y - lapply(y, within, {z-1})
  y
}
f()

it returns list(y1=list(z=1)) as expected.

P.P.S. with() has the same problem:

f - function(x){
  y - list(y1=list())
  w - lapply(y, with, x)
  w
}
f(1)

produces the exact same error as within().

__
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.


[R] How to apply correctly.

2014-01-07 Thread Keith S Weintraub
Folks,

# I have the following function:

breakByFreq-function(freq, defData) {
  breakUpFun-function(freq, defs) {
if(freq != 1) {
  defs-diff(c(0, defs))
  defs-cumsum(rep(defs/freq, each = freq))
}
defs
  }
  defMat-sapply(defData[,-1], function(x) breakUpFun(freq, x))
  data.frame(Year = 1:nrow(defMat), defMat)
}

# And this data (year column and then 2 columns of data):

dum-structure(list(Year = 1:10, 
c1 = c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1), 
c2 = c(0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2)), 
.Names = c(Year, c1, c2), row.names = c(NA, -10L), class = data.frame)

# This works:
breakByFreq(1, dum)

# This doesn't:
breakByFreq(1, dum[,-3])


# How do I use and choose the appropriate apply function to make this work when 
there is one and or more columns to be processed.

Thanks for your time,
KW



--

__
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.


Re: [R] Packaging: Doubt in relation with R CMD Rd2pdf packagename

2014-01-07 Thread Eva Prieto Castro
Thanks Rich. I used your indications, but it was correctly in PATH variable. My 
path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.

I send you a print. Do you have any other idea?.

Thanks again.

Eva






El Lunes 6 de enero de 2014 23:36, Eva Prieto Castro evapcas...@yahoo.es 
escribió:
 


Hi everybody,

I have created a package without documentation and now I want to create it with 
a pdf manual. That is the reason why I have created the .Rd files in man 
folder. In this way I obtain a pdf manual usind R CMD check packagename, but 
it ignores the \code{\link{function.name}}... I mean the function.name does not 
appear as a hiperlink although I use \link in the rd file. 


I supose (I don't know if that is true) that the hiperlink and index requires 
other way of generating the pdf manual, but when I use R CMD Rd2pdf 
packagename I obtain the following error:

Error: running 'texti2dvi' on 'Rd2.tex' failed
LaTeX errors:
!pdfTeX error: pdflatex.EXE file t1-zi4r-0: Fot t1-zi4r-0 at 540 not found -- 
Fatal error ocurred, no output PDF file produced!
Error in running tools::texti2pdf()

Sometimes the message error mentions inconsolata and zi4.sty. Then I install 
(or uninstall) inconsolata since MikTex package manager and the error turns to 
the other I described.

I am using MikTeX 2.9 in Windows 8. I have tested in Windows 7 and the results 
are the same.

How can I obtain the pdf manual?. The fact of solving this problem is very 
important for me.

Thank you in advance.

Regards.

Eva__
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.


Re: [R] Packaging: Doubt in relation with R CMD Rd2pdf packagename

2014-01-07 Thread Richard M. Heiberger
The image suggests that you are missing a font.  Someone else might be
able to help with that.


On Tue, Jan 7, 2014 at 12:50 PM, Eva Prieto Castro evapcas...@yahoo.es wrote:
 Thanks Rich. I used your indications, but it was correctly in PATH variable.
 My path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.

 I send you a print. Do you have any other idea?.

 Thanks again.

 Eva




 El Lunes 6 de enero de 2014 23:36, Eva Prieto Castro evapcas...@yahoo.es
 escribió:

 Hi everybody,

 I have created a package without documentation and now I want to create it
 with a pdf manual. That is the reason why I have created the .Rd files in
 man folder. In this way I obtain a pdf manual usind R CMD check
 packagename, but it ignores the \code{\link{function.name}}... I mean the
 function.name does not appear as a hiperlink although I use \link in the rd
 file.

 I supose (I don't know if that is true) that the hiperlink and index
 requires other way of generating the pdf manual, but when I use R CMD
 Rd2pdf packagename I obtain the following error:

 Error: running 'texti2dvi' on 'Rd2.tex' failed
 LaTeX errors:
 !pdfTeX error: pdflatex.EXE file t1-zi4r-0: Fot t1-zi4r-0 at 540 not found
 -- Fatal error ocurred, no output PDF file produced!
 Error in running tools::texti2pdf()

 Sometimes the message error mentions inconsolata and zi4.sty. Then I install
 (or uninstall) inconsolata since MikTex package manager and the error turns
 to the other I described.

 I am using MikTeX 2.9 in Windows 8. I have tested in Windows 7 and the
 results are the same.

 How can I obtain the pdf manual?. The fact of solving this problem is very
 important for me.

 Thank you in advance.

 Regards.

 Eva




__
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.


Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread Duncan Murdoch

On 07/01/2014 10:35 AM, Pavel N. Krivitsky wrote:

Hi,

I have a list of sublists, and I want to add and/or remove elements in
each sublist in accordance with a code snippet. I had thought that an
elegant way to do that is using a combination of lapply() and within().
However, the code in the within() call doesn't seem to be able to see
objects outside of it. For (a simplified) example,

f - function(x){
   y - list(y1=list())
   y - lapply(y, within, {z-x})
   y
}
f(1)

My understanding is that what should happen is that lapply() would
execute

within(y[[y1]], {z-x}),

with 1 substituted for x, within() would notice that z has been assigned
1, returning list(z=1), which then gets put into a list as element named
y1, so the function should ultimately return

list(y1=list(z=1))

What I get instead (on R 3.0.2 and current trunk, both on Linux) is

Error in eval(expr, envir, enclos) : object 'x' not found

Am I doing something wrong, or is this a bug?
I wouldn't call it a bug, but it's a documented limitation, if you know 
how to read it.  As documented, the expression is evaluated with the 
caller's environment as the parent environment.  But here the caller is 
some code in lapply, not your function f.  x is not found there.


I think this modification works, and is maybe the simplest way to get it 
to work:


f - function(x){
  y - list(y1=list())
  mywithin - function(...) within(...)
  y - lapply(y, mywithin, {z-x})
  y
}

The idea here is that the calling frame of f is the environment of 
mywithin(), so x is found there.


Duncan Murdoch



Thanks in advance,
Pavel

P.S. If I hard-code the value for x, i.e.,

f - function(){
   y - list(y1=list())
   y - lapply(y, within, {z-1})
   y
}
f()

it returns list(y1=list(z=1)) as expected.

P.P.S. with() has the same problem:

f - function(x){
   y - list(y1=list())
   w - lapply(y, with, x)
   w
}
f(1)

produces the exact same error as within().

__
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.


__
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.


Re: [R] How to apply correctly.

2014-01-07 Thread Patrick Burns

I think you will be okay if you change
one line to:

defMat-sapply(defData[,-1, drop=FALSE], function(x) breakUpFun(freq, x))

In your example that doesn't work you are
ending up with a vector rather than a one
column data frame.

Pat


On 07/01/2014 17:44, Keith S Weintraub wrote:

Folks,

# I have the following function:

breakByFreq-function(freq, defData) {
   breakUpFun-function(freq, defs) {
 if(freq != 1) {
   defs-diff(c(0, defs))
   defs-cumsum(rep(defs/freq, each = freq))
 }
 defs
   }
   defMat-sapply(defData[,-1], function(x) breakUpFun(freq, x))
   data.frame(Year = 1:nrow(defMat), defMat)
}

# And this data (year column and then 2 columns of data):

dum-structure(list(Year = 1:10,
 c1 = c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1),
 c2 = c(0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2)),
.Names = c(Year, c1, c2), row.names = c(NA, -10L), class = data.frame)

# This works:
breakByFreq(1, dum)

# This doesn't:
breakByFreq(1, dum[,-3])


# How do I use and choose the appropriate apply function to make this work when there is 
one and or more columns to be processed.

Thanks for your time,
KW



--

__
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.



--
Patrick Burns
pbu...@pburns.seanet.com
twitter: @burnsstat @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of:
 'Impatient R'
 'The R Inferno'
 'Tao Te Programming')

__
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.


Re: [R] How to apply correctly.

2014-01-07 Thread Keith S Weintraub
Thanks Patrick,

That did the trick.

Oddly enough (or maybe not that oddly) I was looking through The R Inferno to 
try and find the answer. Since I often forget that there are other parameters 
available to '[' I never made it to 8.1.44 on dropping dimensions.

Hopefully this lesson will stick with me!

Thanks again,
All the best,
Happy New Year,
KW

--

On Jan 7, 2014, at 1:32 PM, Patrick Burns pbu...@pburns.seanet.com wrote:

 I think you will be okay if you change
 one line to:
 
 defMat-sapply(defData[,-1, drop=FALSE], function(x) breakUpFun(freq, x))
 
 In your example that doesn't work you are
 ending up with a vector rather than a one
 column data frame.
 
 Pat
 
 
 On 07/01/2014 17:44, Keith S Weintraub wrote:
 Folks,
 
 # I have the following function:
 
 breakByFreq-function(freq, defData) {
   breakUpFun-function(freq, defs) {
 if(freq != 1) {
   defs-diff(c(0, defs))
   defs-cumsum(rep(defs/freq, each = freq))
 }
 defs
   }
   defMat-sapply(defData[,-1], function(x) breakUpFun(freq, x))
   data.frame(Year = 1:nrow(defMat), defMat)
 }
 
 # And this data (year column and then 2 columns of data):
 
 dum-structure(list(Year = 1:10,
 c1 = c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 
 0.1),
 c2 = c(0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16, 0.18, 
 0.2)),
 .Names = c(Year, c1, c2), row.names = c(NA, -10L), class = 
 data.frame)
 
 # This works:
 breakByFreq(1, dum)
 
 # This doesn't:
 breakByFreq(1, dum[,-3])
 
 
 # How do I use and choose the appropriate apply function to make this work 
 when there is one and or more columns to be processed.
 
 Thanks for your time,
 KW
 
 
 
 --
 
 __
 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.
 
 
 -- 
 Patrick Burns
 pbu...@pburns.seanet.com
 twitter: @burnsstat @portfolioprobe
 http://www.portfolioprobe.com/blog
 http://www.burns-stat.com
 (home of:
 'Impatient R'
 'The R Inferno'
 'Tao Te Programming')

__
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.


Re: [R] with() and within() functions inside lapply() not seeing outside of its environment?

2014-01-07 Thread peter dalgaard

On 07 Jan 2014, at 19:19 , Duncan Murdoch murdoch.dun...@gmail.com wrote:

 I wouldn't call it a bug, but it's a documented limitation, if you know how 
 to read it.  As documented, the expression is evaluated with the caller's 
 environment as the parent environment.  But here the caller is some code in 
 lapply, not your function f.  x is not found there.

I'd also consider it a bit brave to rely on ...-args to lapply being passed 
down unevaluated, but that does apparently work. 

At any rate, you cannot both have x evaluated in the frame of f, and the 
assignment to z _not_ evaluated there.

 
 I think this modification works, and is maybe the simplest way to get it to 
 work:
 
 f - function(x){
  y - list(y1=list())
  mywithin - function(...) within(...)
  y - lapply(y, mywithin, {z-x})
  y
 }

There is also brute-force substitution:

 f - function(x){
+  y - list(y1=list())
+  y - eval(bquote(lapply(y, within, {z-.(x)})))
+  y
+ }
 f(1)
$y1
$y1$z
[1] 1



 
 The idea here is that the calling frame of f is the environment of 
 mywithin(), so x is found there.
 
 Duncan Murdoch
 
 
Thanks in advance,
Pavel
 
 P.S. If I hard-code the value for x, i.e.,
 
 f - function(){
   y - list(y1=list())
   y - lapply(y, within, {z-1})
   y
 }
 f()
 
 it returns list(y1=list(z=1)) as expected.
 
 P.P.S. with() has the same problem:
 
 f - function(x){
   y - list(y1=list())
   w - lapply(y, with, x)
   w
 }
 f(1)
 
 produces the exact same error as within().
 
 __
 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.
 
 __
 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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.


Re: [R] Packaging: Doubt in relation with R CMD Rd2pdf packagename

2014-01-07 Thread Eva Prieto Castro
Hi again:

Rich, I see your messages but they are sent to another mail address so I have 
to write from here without using your answer.

I think the problem is that inconsolata.sty is not found, and zi4.sty is not 
found.

I have read several documents in www about this question but I can not solve it.

Please could anybody help me?



Thanks.

Eva




El Martes 7 de enero de 2014 20:00, Eva Prieto Castro evapcas...@yahoo.es 
escribió:
 
Thanks Rich. I used your indications, but it was correctly in PATH variable. My 
path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.

I send you a print. Do you have any other idea?.

Thanks again.

Eva







El Lunes 6 de enero de 2014 23:36, Eva Prieto Castro evapcas...@yahoo.es 
escribió:



Hi everybody,

I have created a package without documentation and now I want to create it with 
a pdf manual. That is the reason why I have created the .Rd files in man 
folder. In this way I obtain a pdf manual usind R CMD check packagename, but 
it ignores the \code{\link{function.name}}... I mean the function.name does not 
appear as a hiperlink although I use \link in the rd file. 


I supose (I don't know if that is true) that the hiperlink and index requires 
other way of generating the pdf manual, but when I use R CMD Rd2pdf 
packagename I obtain the following error:

Error: running 'texti2dvi' on 'Rd2.tex' failed
LaTeX errors:
!pdfTeX error: pdflatex.EXE file t1-zi4r-0: Fot t1-zi4r-0 at 540 not found -- 
Fatal error ocurred, no output PDF file produced!
Error in running tools::texti2pdf()

Sometimes the message error mentions inconsolata and zi4.sty. Then I install 
(or uninstall) inconsolata since MikTex package manager and the error turns to 
the other I described.

I am using MikTeX 2.9 in Windows 8. I have tested in Windows 7 and the results 
are the same.

How can I obtain the pdf manual?. The fact of solving this problem is very 
important for me.

Thank you in advance.

Regards.

Eva

__
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.


Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-07 Thread Adams, Jean
Patrick,

You were pretty close.
To fix the code you have, just change matrix to mymatrix in two places,
and either specify the argument data= or place the heat.colors bit first in
the matrix function.

Or ... you could use the array() function instead, to shorten up the code a
little.
 mycol - array(heat.colors(max(mymatrix[, 3:5]))[mymatrix[, 3:5]],
dim=dim(mymatrix))

Jean


On Mon, Jan 6, 2014 at 9:19 PM, Pachapep pacha...@gmail.com wrote:

 Hi all,
 I have a matrix which I want to plot in color. I have extensively looked
 at level plot and heatmap/heatmap.2, but I would like to be able to manage
 the size of the bins (boxes)  on my X axis. So I thought of simply using
 the rect() function, but I can’t get around assigning the correct colors to
 all the values. I have built a RectPlotter() function that takes the start
 and stop as well as the value assigned to each ‘bin’.
 Here is what I have done so far (after countless hours of despair):

 RectPlotter - function(matrixval, ycoord, height, mycolors){
  rect(matrixval[,1], (ycoord-(0.4*height)), matrixval[,2],
 (ycoord+(0.4*height)), col=mycolors, border = NA)
 }

 starts - c(1,5,8,15)
 ends - c(5, 8, 15, 25)
 vals1 - c(2, 15, 7, 13)
 vals2 - c(7, 2, 1, 26)
 vals3 - c(52, 1, 29, 18)
 mymatrix - cbind(starts, ends, vals1, vals2, vals3)
 # This gives me an error
 mycol- matrix(nrow=dim(mymatrix)[1], ncol=dim(mymatrix)[2],
 heat.colors(max(matrix[,3:5]))[matrix[,3:5]])


 At the end, I would like to have something like a levelplot, but using the
 starts and ends as x-axis.
 Any help would be highly appreciated. Thanks!
 Patrick
 __
 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.


Re: [R] Packaging: Doubt in relation with R CMD Rd2pdf packagename

2014-01-07 Thread Eva Prieto Castro
Hi Rich, Hi everybody

I have solved the problem!. I installed MikTeX 2.9 again, but this time I chose 
basic installation (the other one I had chosen complete installation). I 
noticed a diference if we compare with the previous situation: now R and MikTeX 
are installed in the same folder (ProgramFiles) - in the previous situation R 
was in Program Files and MikTeX was in Program Files (x86).

Now R CMD check runs correctly and R CMD Rd2pdf runs correctly too.

I am very happy with the results!.

Thank you!

Eva





El Martes 7 de enero de 2014 18:50, Eva Prieto Castro evapcas...@yahoo.es 
escribió:
 
Thanks Rich. I used your indications, but it was correctly in PATH variable. My 
path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.

I send you a print. Do you have any other idea?.

Thanks again.

Eva






El Lunes 6 de enero de 2014 23:36, Eva Prieto Castro evapcas...@yahoo.es 
escribió:
 


Hi everybody,

I have created a package without documentation and now I want to create it with 
a pdf manual. That is the reason why I have created the .Rd files in man 
folder. In this way I obtain a pdf manual usind R CMD check packagename, but 
it ignores the \code{\link{function.name}}... I mean the function.name does not 
appear as a hiperlink although I use \link in the rd file. 


I supose (I don't know if that is true) that the hiperlink and index requires 
other way of generating the pdf manual, but when I use R CMD Rd2pdf 
packagename I obtain the following error:

Error: running 'texti2dvi' on 'Rd2.tex' failed
LaTeX errors:
!pdfTeX error: pdflatex.EXE file t1-zi4r-0: Fot t1-zi4r-0 at 540 not found -- 
Fatal error ocurred, no output PDF file produced!
Error in running tools::texti2pdf()

Sometimes the message error mentions inconsolata and zi4.sty. Then I install 
(or uninstall) inconsolata since MikTex package manager and the error turns to 
the other I described.

I am using MikTeX 2.9 in Windows 8. I have tested in Windows 7 and the results 
are the same.

How can I obtain the pdf manual?. The fact of solving this problem is very 
important for me.

Thank you in advance.

Regards.

Eva
[[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.


Re: [R] Packaging: Doubt in relation with R CMD Rd2pdf packagename

2014-01-07 Thread Duncan Murdoch

On 14-01-07 3:35 PM, Eva Prieto Castro wrote:

Hi Rich, Hi everybody

I have solved the problem!. I installed MikTeX 2.9 again, but this time I chose 
basic installation (the other one I had chosen complete installation). I 
noticed a diference if we compare with the previous situation: now R and MikTeX 
are installed in the same folder (ProgramFiles) - in the previous situation R 
was in Program Files and MikTeX was in Program Files (x86).


I would guess the change of location isn't what solved this, but rather 
that the basic installation loads LaTeX packages on demand, so you 
probably get newer versions.


Duncan Murdoch


Now R CMD check runs correctly and R CMD Rd2pdf runs correctly too.

I am very happy with the results!.

Thank you!

Eva





El Martes 7 de enero de 2014 18:50, Eva Prieto Castro evapcas...@yahoo.es 
escribió:

Thanks Rich. I used your indications, but it was correctly in PATH variable. My 
path is C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.

I send you a print. Do you have any other idea?.

Thanks again.

Eva






El Lunes 6 de enero de 2014 23:36, Eva Prieto Castro evapcas...@yahoo.es 
escribió:



Hi everybody,

I have created a package without documentation and now I want to create it with a pdf 
manual. That is the reason why I have created the .Rd files in man folder. In this way I 
obtain a pdf manual usind R CMD check packagename, but it ignores the 
\code{\link{function.name}}... I mean the function.name does not appear as a hiperlink 
although I use \link in the rd file.


I supose (I don't know if that is true) that the hiperlink and index requires other way 
of generating the pdf manual, but when I use R CMD Rd2pdf packagename I 
obtain the following error:

Error: running 'texti2dvi' on 'Rd2.tex' failed
LaTeX errors:
!pdfTeX error: pdflatex.EXE file t1-zi4r-0: Fot t1-zi4r-0 at 540 not found -- 
Fatal error ocurred, no output PDF file produced!
Error in running tools::texti2pdf()

Sometimes the message error mentions inconsolata and zi4.sty. Then I install 
(or uninstall) inconsolata since MikTex package manager and the error turns to 
the other I described.

I am using MikTeX 2.9 in Windows 8. I have tested in Windows 7 and the results 
are the same.

How can I obtain the pdf manual?. The fact of solving this problem is very 
important for me.

Thank you in advance.

Regards.

Eva
[[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.



__
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.


[R] A calculation in data.frame

2014-01-07 Thread Ron Michael
Hi,

I have to perform some formula driven calculation in a data.frame (as defined 
below). Let say I have following DF:

 DF - data.frame(A1 = c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), A2 = 
 c('m', 'n', 'p', 'm', 'n', 'p', 'm', 'n', 'p'), A3 = c(1,2,3,4,5,6,7,8,9))
 DF
  A1 A2 A3
1  a  m  1
2  a  n  2
3  a  p  3
4  b  m  4
5  b  n  5
6  b  p  6
7  c  m  7
8  c  n  8
9  c  p  9


Now let say, user gives one formula which will be applied on the elements of A1 
column. Let say the formula looks like:

z = a + 2*b + c (infact the formula will be arbitrary like z = f(a, b, c))

Once such formula is given, the result will be like (for the columns A1, A2, A3 
respectively)

z m 16
z n 20
z p 24

the last column comes from the fact that 1 + 2*4 + 7 = 16, 2 + 2*5 + 8 = 20, 3 
+ 2*6 + 9 = 24

Given that the formula wil be user defined, and to be applied on some 
data.frame like DF, I am seeking some automated way to accomplice the task for 
really big DF of previous kind and fairly complex formula.

Can somebody suggest me for efficient way to perform this task in R?

Really appreciate your help.

Thanks, 

__
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.


Re: [R] A calculation in data.frame

2014-01-07 Thread arun
HI,
May be this helps:
library(reshape2)
 df1 - dcast(DF,A2~A1,value.var=A3)
z - function(a,b,c){a+2*b+c}
  within(df1, newCol - z(a,b,c)) 
#  A2 a b c newCol
#1  m 1 4 7 16
#2  n 2 5 8 20
#3  p 3 6 9 24





On Tuesday, January 7, 2014 4:15 PM, Ron Michael ron_michae...@yahoo.com 
wrote:
Hi,

I have to perform some formula driven calculation in a data.frame (as defined 
below). Let say I have following DF:

 DF - data.frame(A1 = c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), A2 = 
 c('m', 'n', 'p', 'm', 'n', 'p', 'm', 'n', 'p'), A3 = c(1,2,3,4,5,6,7,8,9))
 DF
  A1 A2 A3
1  a  m  1
2  a  n  2
3  a  p  3
4  b  m  4
5  b  n  5
6  b  p  6
7  c  m  7
8  c  n  8
9  c  p  9


Now let say, user gives one formula which will be applied on the elements of A1 
column. Let say the formula looks like:

z = a + 2*b + c (infact the formula will be arbitrary like z = f(a, b, c))

Once such formula is given, the result will be like (for the columns A1, A2, A3 
respectively)

z m 16
z n 20
z p 24

the last column comes from the fact that 1 + 2*4 + 7 = 16, 2 + 2*5 + 8 = 20, 3 
+ 2*6 + 9 = 24

Given that the formula wil be user defined, and to be applied on some 
data.frame like DF, I am seeking some automated way to accomplice the task for 
really big DF of previous kind and fairly complex formula.

Can somebody suggest me for efficient way to perform this task in R?

Really appreciate your help.

Thanks, 

__
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.

__
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.


[R] about R

2014-01-07 Thread sevda datlı
Hello,

I am a master student in Educational Measurement and Evaluation, my thesis
subject is “comparison of estimation methods used for confirmatory factor
analysis”. For my thesis study, I need to generate datas that provides some
features. I will generate these datas by changing correlation between
factors, number of factors, types of items, number of items for a factor,
sample size(for example, i want to generate seperate datas for 200 and 500
as sample size ). I would be very grateful if you would help me to generate
these datas using R. I installed the R program, also installed the “psych”
package but I could not go any further to generate my desired datas.
Best Regards,
Sevda

[[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.


Re: [R] about R

2014-01-07 Thread Greg Snow
Look at the mvrnorm function in the MASS package.

The within or transform functions may also be of use to you in
creating the data as a combination of the factors that you create
using mvrnorm.


On Tue, Jan 7, 2014 at 2:15 PM, sevda datlı sevdad...@gmail.com wrote:
 Hello,

 I am a master student in Educational Measurement and Evaluation, my thesis
 subject is “comparison of estimation methods used for confirmatory factor
 analysis”. For my thesis study, I need to generate datas that provides some
 features. I will generate these datas by changing correlation between
 factors, number of factors, types of items, number of items for a factor,
 sample size(for example, i want to generate seperate datas for 200 and 500
 as sample size ). I would be very grateful if you would help me to generate
 these datas using R. I installed the R program, also installed the “psych”
 package but I could not go any further to generate my desired datas.
 Best Regards,
 Sevda

 [[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.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
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.


Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-07 Thread Adams, Jean
Patrick,

You should cc r-help on all correspondence so that others can follow the
thread.

The color range will be matched to the x argument you provide to the
color.scale function (in package plotrix).  So you don't need to manually
provide the min and max yourself.  If for some reason you did need to
provide that information, you would use the xrange argument not the
extremes argument (which is expecting colors).

mycolors - color.scale(mymatrix[,-(1:2)], c(0,1,1), c(1,1,0), c(1,0,1))

Jean


On Tue, Jan 7, 2014 at 4:16 PM, Pachapep pacha...@gmail.com wrote:


 Hi Jean
 Thanks for the quick answer. It looks like it works, but the issue is that
 my real data fluctuates between 0 and 2, so I everything is red.
 I tried using another function (color.scale), which works but gives me
 grey scale only (no colors) although I don’t really understand why - it’s a
 detail, but it's kind of a bummer..

 mycolors - color.scale(mymatrix[,-(1:2)], c(0,1,1), c(1,1,0), c(1,0,1),
 extremes=c(min(mymatrix[,-(1:2)]), max(mymatrix[,-(1:2)])))

 Is there a way to make an array using the min and max of the matrix (as I
 used in color.scale() above) so that the colors go from blue to red?
 Thanks again for the help.
 Patrick

 On Jan 7, 2014, at 15:04, Adams, Jean jvad...@usgs.gov wrote:

 Patrick,

 You were pretty close.
 To fix the code you have, just change matrix to mymatrix in two
 places, and either specify the argument data= or place the heat.colors bit
 first in the matrix function.

 Or ... you could use the array() function instead, to shorten up the code
 a little.
  mycol - array(heat.colors(max(mymatrix[, 3:5]))[mymatrix[, 3:5]],
 dim=dim(mymatrix))

 Jean


 On Mon, Jan 6, 2014 at 9:19 PM, Pachapep pacha...@gmail.com wrote:

 Hi all,
 I have a matrix which I want to plot in color. I have extensively looked
 at level plot and heatmap/heatmap.2, but I would like to be able to manage
 the size of the bins (boxes)  on my X axis. So I thought of simply using
 the rect() function, but I can’t get around assigning the correct colors to
 all the values. I have built a RectPlotter() function that takes the start
 and stop as well as the value assigned to each ‘bin’.
 Here is what I have done so far (after countless hours of despair):

 RectPlotter - function(matrixval, ycoord, height, mycolors){
  rect(matrixval[,1], (ycoord-(0.4*height)), matrixval[,2],
 (ycoord+(0.4*height)), col=mycolors, border = NA)
 }

 starts - c(1,5,8,15)
 ends - c(5, 8, 15, 25)
 vals1 - c(2, 15, 7, 13)
 vals2 - c(7, 2, 1, 26)
 vals3 - c(52, 1, 29, 18)
 mymatrix - cbind(starts, ends, vals1, vals2, vals3)
 # This gives me an error
 mycol- matrix(nrow=dim(mymatrix)[1], ncol=dim(mymatrix)[2],
 heat.colors(max(matrix[,3:5]))[matrix[,3:5]])


 At the end, I would like to have something like a levelplot, but using
 the starts and ends as x-axis.
 Any help would be highly appreciated. Thanks!
 Patrick
 __
 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.htmlhttp://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.


Re: [R] Dataset to single column matrix

2014-01-07 Thread Pete Brecknock
Krishia wrote
 Hello,
 I am pretty new to R and would like to transform my 272x12 matrix into a
 3264X1. I'm trying to have the setup change from:
 
 1,  2,  3,  4, 5,  6, 7,  8, 9, 10, 11, 12
 13,14,15,16,17,18,19,20,21,22, 23, 24
 etc.
 
 to
 
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 etc.
 
 Any suggestions?
 Thanks in advance

Krishia

Is this what you are looking for?

# Create example matrice
m - matrix(c(1,2,3,4,5,6,7,8,9,10,11,12), nrow=4, byrow=TRUE)

# Create vector
v - c(t(m))

HTH

Pete



--
View this message in context: 
http://r.789695.n4.nabble.com/Dataset-to-single-column-matrix-tp4683231p4683238.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Dataset to single column matrix

2014-01-07 Thread Ista Zahn
On Tue, Jan 7, 2014 at 8:30 PM, Pete Brecknock peter.breckn...@bp.com wrote:
 Krishia wrote
 Hello,
 I am pretty new to R and would like to transform my 272x12 matrix into a
 3264X1. I'm trying to have the setup change from:

 1,  2,  3,  4, 5,  6, 7,  8, 9, 10, 11, 12
 13,14,15,16,17,18,19,20,21,22, 23, 24
 etc.

 to

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 etc.

 Any suggestions?
 Thanks in advance

 Krishia

 Is this what you are looking for?

 # Create example matrice
 m - matrix(c(1,2,3,4,5,6,7,8,9,10,11,12), nrow=4, byrow=TRUE)

 # Create vector
 v - c(t(m))

Or just

dim(m) - NULL

Best,
Ista


 HTH

 Pete



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Dataset-to-single-column-matrix-tp4683231p4683238.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.

__
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.


Re: [R] How do I perform conditional annotation of lattice panel plots?

2014-01-07 Thread Duncan Mackay

Hi George

If you did not want a line through the point try this

xyplot(Activity ~ Day | Subject, data = Data,pch =
ifelse(is.na(Data$EventA), 1,16), col = ifelse(is.na(Data$EventA), 4,2))

You could make a column of it otherwise change EventA to numeric - easier to
work with

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Chen, George
Sent: Wednesday, 8 January 2014 00:07
To: r-help@r-project.org
Subject: [R] How do I perform conditional annotation of lattice panel plots?

My apologies for asking this question that may have been asked before. I am
trying to plot activity dependent on time conditioned by the subject. Code
for sample data below.

So I have something like this

xyplot(Activity~Time|Subject).
This works fine, but now I want to show where on these activity curves Event
A occurs. This is to explore the relationship between A and activity.

I tried this:

xyplot(EventA+Activity~Time|Subject)

but then the numerical ordering gets out of order.
Ideally Event A could be denoted by a vertical line cutting through the
curve at the day Event A occurred, but some other way to denote it would be
great!

Here is my sample data as R code:

Subject-c(1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4)
Day-c(1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6)
Activity-c(2,3,4,3,7,4,5,8,2,8,4,6,2,5,3,8,9,5,6,3,4,5,6,7)
EventA-c(Yes,NA,Yes,NA,NA,NA,Yes,NA,NA,NA,NA,NA,
  Yes,NA,NA,NA,NA,NA,NA,NA,Yes,NA,NA,NA)
Data-data.frame(cbind(Subject,Day,Activity,EventA))

  Subject Day Activity EventA
11   12Yes
21   23   NA
31   34Yes
41   43   NA
51   57   NA
61   64   NA
72   15Yes
82   28   NA
92   32   NA
10   2   48   NA
11   2   54   NA
12   2   66   NA
13   3   12Yes
14   3   25   NA
15   3   33   NA
16   3   48   NA
17   3   59   NA
18   3   65   NA
19   4   16   NA
20   4   23   NA
21   4   34Yes
22   4   45   NA
23   4   56   NA
24   4   67   NA
Any ideas on how to do this would be appreciated!

Thanks very much in advance!


This email message may contain legally privileged and/or confidential
information.  If you are not the intended recipient(s), or the employee or
agent responsible for the delivery of this message to the intended
recipient(s), you are hereby notified that any disclosure, copying,
distribution, or use of this email message is prohibited.  If you have
received this message in error, please notify the sender immediately by
e-mail and delete this email message from your computer. Thank you.
[[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.

__
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.


Re: [R] Dataset to single column matrix

2014-01-07 Thread Rolf Turner

On 08/01/14 15:09, Ista Zahn wrote:

On Tue, Jan 7, 2014 at 8:30 PM, Pete Brecknock peter.breckn...@bp.com wrote:

Krishia wrote

Hello,
I am pretty new to R and would like to transform my 272x12 matrix into a
3264X1. I'm trying to have the setup change from:

1,  2,  3,  4, 5,  6, 7,  8, 9, 10, 11, 12
13,14,15,16,17,18,19,20,21,22, 23, 24
etc.

to

1
2
3
4
5
6
7
8
9
10
11
12
etc.

Any suggestions?
Thanks in advance


Krishia

Is this what you are looking for?

# Create example matrice
m - matrix(c(1,2,3,4,5,6,7,8,9,10,11,12), nrow=4, byrow=TRUE)

# Create vector
v - c(t(m))


Or just

dim(m) - NULL


No.  That produces column-by-column order, and it appears that the OP 
wanted row-by-row order, which is what Peter's solution gives.


BTW it is considered more politically correct to use as.vector(M) 
rather than c(M) to turn a matrix into a vector, although the result is 
exactly the same.


cheers,

Rolf Turner

__
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.


Re: [R] How to detect a sequence of NA values?

2014-01-07 Thread arun
Hi,
Try:
rl - rle(is.na(a))
 max(rl$lengths[rl$values])
#[1] 3


A.K.


Hi, 

I'd like to detect whether a vector contains a sequence of NA values of a 
certain length. So, for example, if I have a vector a = 
c(1,NA,NA,4,NA,NA,NA,5); how can I find what the longest sequence of NAs is (in 
this case 3)? 

Note that this is different from simply summing the number of NA values in the 
vector (which would be 5 in this case)... 

Thanks for your help !

__
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.


Re: [R] Dataset to single column matrix

2014-01-07 Thread arun
Hi,

You could try:
mat1 - matrix(1:(272*12),ncol=12,byrow=TRUE)
 mat2 - t(mat1)
 dim(mat2) - c(272*12,1)


#or
mat3 - matrix(as.vector(mat2),ncol=1)
identical(mat2,mat3)
#[1] TRUE


A.K.

Hello, 
I am pretty new to R and would like to transform my 272x12 matrix into a 
3264X1. I'm trying to have the setup change from: 

1,  2,  3,  4, 5,  6, 7,  8, 9, 10, 11, 12 
13,14,15,16,17,18,19,20,21,22, 23, 24 
etc. 

to 

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
etc. 

Any suggestions? 
Thanks in advance

__
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.


[R] Implementing A Formula

2014-01-07 Thread Norman McBride
Hello R Mailing List Members,
  My name is Peter. I am a high school student who is doing a senior
thesis in statistical analysis. As you can see that I have chosen R. So for
the project I am working with a member of the US Navy and analyzing some
data. So for this data I am using a formula to find a cooling coefficient.
This formula gets it own column in the table/display frame. So I wanted to
know if put this formula into the display frame would I need to go row by
row plugging this formula in to only take data from that individual row or
would it just do that for me? If I did have to do it row by row would there
be anyway I could expedite the process because it is over 2000 rows. Thank
you for any help you are able to give me.

  -Peter

[[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.


[R] Patterns on postal codes

2014-01-07 Thread Jeff Johnson
Hi all,

I'm pretty new to R and have a question. I have a postal_code field which
can have a variety of values such as:
For US postal codes: 22942-0173 or 32601
For Canada postal codes: N9YZE6 or S7V 1J9

What I want to do is represent these as patterns, such as:
US: N- or N
Canada: ANAAAN or ANA NAN
where N = any number and A = any alpha character, space = space, etc (other
characters such as ' should be represented as '.

Ultimately I want to count these to see how many have a pattern of
N-, ANA NAN, etc so that I can visualize the outliers.

Does anyone know if there is a built-in function in R to do this?
Currently, the str() function on the postal_code field shows a factor with
90,993 levels which isn't particularly helpful.

Thanks in advance!

-- 
Jeff

[[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.


Re: [R] Implementing A Formula

2014-01-07 Thread Frede Aakmann Tøgersen
Hi

Is is something like this that you want?


mydata - data.frame(a=1:10, b=11:20, c=21:30, d=31:40, e=41:50)

myfun - function(a,b,c)a*b+c

mydata$cool - do.call(myfun, mydata[,c(a, b, c)])

mydata
## a  b  c  d  e cool
## 1   1 11 21 31 41   32
## 2   2 12 22 32 42   46
## 3   3 13 23 33 43   62
## 4   4 14 24 34 44   80
## 5   5 15 25 35 45  100
## 6   6 16 26 36 46  122
## 7   7 17 27 37 47  146
## 8   8 18 28 38 48  172
## 9   9 19 29 39 49  200
## 10 10 20 30 40 50  230

Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance  Modeling

Technology  Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Norman McBride
 Sent: 7. januar 2014 23:46
 To: r-help@r-project.org
 Subject: [R] Implementing A Formula
 
 Hello R Mailing List Members,
   My name is Peter. I am a high school student who is doing a senior
 thesis in statistical analysis. As you can see that I have chosen R. So for
 the project I am working with a member of the US Navy and analyzing some
 data. So for this data I am using a formula to find a cooling coefficient.
 This formula gets it own column in the table/display frame. So I wanted to
 know if put this formula into the display frame would I need to go row by
 row plugging this formula in to only take data from that individual row or
 would it just do that for me? If I did have to do it row by row would there
 be anyway I could expedite the process because it is over 2000 rows. Thank
 you for any help you are able to give me.
 
   -Peter
 
   [[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.

__
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.


Re: [R] Patterns on postal codes

2014-01-07 Thread Frede Aakmann Tøgersen
Hi

Something like this.

## 4 valid zips + 4 invalid zips
zipcode - c(22942-0173, 32601, N9YZE6, S7V 1J9, 0022942-0173, 
32-601, NN9YZE6, S7V  1J9)

tmp - gsub([[:space:]], _, zipcode)
tmp - gsub([[:alpha:]], A, tmp)
tmp - gsub([[:digit:]], N, tmp)

tmp
## [1] N-   NANAAAN   ANA_NAN  
NNN-
## [6] NN-NNN   AANAAAN  ANA__NAN

patterns - c(N-, N, ANAAAN, ANA_NAN)

zipcode[tmp %in% patterns]
## [1] 22942-0173 32601  N9YZE6 S7V 1J9   
zipcode[!tmp %in% patterns]
## [1] 0022942-0173 32-601   NN9YZE6  S7V  1J9


Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance  Modeling

Technology  Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Jeff Johnson
 Sent: 8. januar 2014 00:11
 To: r-help@r-project.org
 Subject: [R] Patterns on postal codes
 
 Hi all,
 
 I'm pretty new to R and have a question. I have a postal_code field which
 can have a variety of values such as:
 For US postal codes: 22942-0173 or 32601
 For Canada postal codes: N9YZE6 or S7V 1J9
 
 What I want to do is represent these as patterns, such as:
 US: N- or N
 Canada: ANAAAN or ANA NAN
 where N = any number and A = any alpha character, space = space, etc (other
 characters such as ' should be represented as '.
 
 Ultimately I want to count these to see how many have a pattern of
 N-, ANA NAN, etc so that I can visualize the outliers.
 
 Does anyone know if there is a built-in function in R to do this?
 Currently, the str() function on the postal_code field shows a factor with
 90,993 levels which isn't particularly helpful.
 
 Thanks in advance!
 
 --
 Jeff
 
   [[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.

__
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.


[R] Different colours for LatticeExtra graphs

2014-01-07 Thread Alvaro
Hello,

I am using the panel.3dpolygon function from the LatticeExtra package. I
am graphing a matrix.

I can't find a way in which each polygon is presented in a different color.

The description of the function says that the col argument permits vectors
(the components of which are colors) to be associated with each bar in a
panel.3dbars graph, but nothing with panel.3dpolygon...

I write a vector while using the function, but it will only use the first
component of the vector to give color to the whole graph.

Thanks,

Alvaro



--
View this message in context: 
http://r.789695.n4.nabble.com/Different-colours-for-LatticeExtra-graphs-tp4683250.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


[R] Raster in parallel computing?

2014-01-07 Thread Camilo Mora

Hi everyone,

I am using the package raster to interpolate a large number of  
rasters (~1million) of different resolutions to a unique 1degree  
resolution grid and wonder if you know if it is possible to do this in  
parallel computer?.


My code (example below) works like a charm but it will take 30 days to  
process all the rasters. Sadly, the process only uses one core of my  
computer. I wonder if there is a way to run this code (example below)  
in parallel computer?.


Thanks,

Camilo

TEST CODE##
library (raster)

#creates 3 test rasters
a - raster(nrow=3, ncol=3)
a[] - 1:9

b - raster(nrow=3, ncol=3)
b[] - 10:18

c - raster(nrow=3, ncol=3)
c[] - 19:27

#concatenates the rasters
d-brick(a,b,c)

#creates a raster at a different resolution
s - raster(nrow=10, ncol=10)

#interpolates data from the brick to the new resolution
s - resample(d, s, method='bilinear')

__
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.