[R] cannot compile R with readline

2017-08-29 Thread Martin Ivanov
Hello,
I am trying to install R-3.4.1 on a linux cluster.  I always get the following 
error message:
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking for rl_callback_read_char in -lreadline... no
checking for main in -lncurses... no
checking for main in -ltermcap... no
checking for main in -ltermlib... no
checking for rl_callback_read_char in -lreadline... no
configure: error: --with-readline=yes (default) and headers/libs are not 
available

As you can see, the R configure script finds the header files, but something 
happens with the rl_callback_read_char. Here is more info on this from the 
config.log:
configure:22995: checking for rl_callback_read_char in -lreadline
configure:23020: mpicc -g -o conftest -O2 -fPIC 
-I/home/giessen/ivanov/build/packages/usr/include 
-I/home/giessen/ivanov/build/packages/usr/include/readline 
-I/home/giessen/ivanov/build/packages/usr/include 
-I/home/giessen/ivanov/build/packages/usr/include/readline 
-L/home/giessen/ivanov/build/packages/usr/lib64 
-L/home/giessen/ivanov/build/packages/lib64 conftest.c -lreadline   >&5
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `PC'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `tgetflag'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `tgetent'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `UP'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `tputs'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `tgoto'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `tgetnum'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `BC'
/home/giessen/ivanov/build/packages/usr/lib64/libreadline.so: undefined 
reference to `tgetstr'
collect2: error: ld returned 1 exit status

I have the readline-6.3 library installed. I compiled it from source, so 
nothing should be missing. Any suggestions will be appreciated.

Best regards,
Martin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] setAs: does it overwrite existing coerce methods?

2016-12-18 Thread Martin Ivanov
Dear R users,

I am working a lot with spatial objects from the package sp. I need to write my 
own method for converting a SpatialGrid
to a SpatialPoints object, because the default method as("SpatialGrid", 
"SpatialPoints") returns a SpatialPoints object with
decreasing latitudes. If I write my own method (that creates a SpatialPoints 
object with both longitudes and latitudes increasing)
using setAs, will it overwrite the default method provided by the sp packages? 
Will this result in breaking all other methods in sp
that use as()? If the sp methods always call the as() method from sp, this 
should not be the case. But if they happen to call the method I 
am going to define instead of the one they expect, they might get broken. So, 
what is your opinion about this is? Is there a way to safely
define a coerce method with setAs that only the code written by me uses, so  
that no other code coming from packages is broken?

Thank you very much!

Best regards,
Martin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] spectral coherence non-overlapping windows: confidence intervals?

2014-10-28 Thread Martin Ivanov
Dear R users,

The confidence intervals for the squared coherence and phase, plotted by 
plot.spec.coherence() and plot.spec.phase, respectively,
use the formulae 10.14 and 10.11 from Bloomfield, P. (1976) Fourier Analysis of 
Time Series: An Introduction. Wiley:

gg - 2/x$df
se - sqrt(gg/2)
 z - -qnorm((1 - ci)/2)
coh - sqrt(x$coh);
(tanh(atanh(coh) + z * se))^2; # this is the 95% line for the coherence
cl - asin(pmin(0., qt(ci, 2/gg - 2) * sqrt(gg *  (coh^{ -2 } - 1)/(2 * (1 
- gg); # this is for the phase

Does somebody know how these formulae extend in case of calculating the 
cross-spectrum via 
K non-overlapping windows, i.e. via the Welch method? I would be very thankful 
if you could direct 
me to some literature. I tried finding something on the topic myself, but the 
information is only
for the case when one smooths with spectral windows.

Best regards,
Martin

__
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] field of two possible types in reference classes

2014-03-24 Thread Martin Ivanov
 Dear R users,
I am learning the OOP programming with R, in particular with reference classes.

If I have a class, e.g.

myclass - setRefClass(class=myclass, fields=list(x=numeric));

I know that if I do not want to set any class for x, I can just type 
fields=list(x=ANY). But what if
I want to allow x to be of two possible classes, e.g. numeric or logical. 
They do not inherit from each other, so setting the one and passing the other 
class results in an error.

Any suggestions will be appreciated.

Best regards,

Martin

__
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] lattice question: removing strips

2014-02-10 Thread Martin Ivanov
 Dear lattice users,

I am trying to produce a lattice graph with two conditioning variables.
My problem is that I only want to show the strips for the levels of the second 
conditioning variable.
I want to remove the strips for the levels of the first conditioning variable.
I tried with the strip function, but if I tell it to return FALSE or NULL 
whenever which.given == 1, I just get empty space below the strips for the 
second conditioning variable. And I want to remove that space altogether. Is it 
somehow achievable in lattice?

I also tried setting layout.heights$strip to 0 when which.given == 1, but it 
seems to only work globally, so either
the strips for both conditioning variables vanish, or both are present.

Any suggestions will be appreciated.


Best regards,

__
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] lattice question: removing strips

2014-02-10 Thread Martin Ivanov
 
Dear Pascal, 
Thank You very much for Your reply. Here is a minimal working example:

library(lattice);
# this is with both strips plotted:
data - data.frame(x=1:5, y=6:10, f1=c(a1, a1, a1, a2, a3), 
f2=c(b1, b2, b2, b1, b2));
p - xyplot(y ~ x | f1 + f2, data=data)
print(p);

# and this is my attempt to only plot the strips for the second conditioning 
variable, i.e. for f2:
my.strip - function(which.given, strip.levels, ...) {
  if(which.given == 1) {
return(FALSE);
  }
  else {
strip.default(which.given=which.given, strip.levels=c(TRUE, FALSE), ...);
  }
}

p1 - xyplot(y ~ x | f1 + f2, data=data, strip=my.strip)
print(p1);

#As You can see, here I do not get the strips for f1 potted, but there is an 
empty space below
the strips for f1, which I cannot get rid of. I only want to show the strips 
for f2. Directly
below them I want to see the panels themselves, instead of an empty space for 
the missing f1 strips.

Any suggestions?

Best regards,

Martin



  Оригинално писмо 
 От:  Pascal Oettli 
 Относно: Re: [R] lattice question: removing strips
 До: Martin Ivanov 
 Изпратено на: Понеделник, 2014, Февруари 10 12:56:21 EET
 
 
 Hello,
 
 Please provide a quot;commented, minimal, self-contained, reproducible
 codequot;, as requested.
 
 Regards,
 Pascal
 
 On 10 February 2014 19:48, Martin Ivanov  wrote:
   Dear lattice users,
 
  I am trying to produce a lattice graph with two conditioning variables.
  My problem is that I only want to show the strips for the levels of the 
  second conditioning variable.
  I want to remove the strips for the levels of the first conditioning 
  variable.
  I tried with the strip function, but if I tell it to return FALSE or NULL 
  whenever which.given == 1, I just get empty space below the strips for the 
  second conditioning variable. And I want to remove that space altogether. 
  Is it somehow achievable in lattice?
 
  I also tried setting layout.heights#36;strip to 0 when which.given == 1, 
  but it seems to only work globally, so either
  the strips for both conditioning variables vanish, or both are present.
 
  Any suggestions will be appreciated.
 
 
  Best regards,
 
  __
  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.
 
 
 
 -- 
 Pascal Oettli
 Project Scientist
 JAMSTEC
 Yokohama, Japan
 

__
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] avoiding eval parse with indexing

2013-05-26 Thread Martin Ivanov
 Hello,
I would like to get an advice on how the notorious eval(parse()) construct 
could possibly 
be avoided in the following example. I have an array x, which can have 
different number of dimensions,
but I am only interested in extracting, say, the first element of the first 
dimension. Currently I achieve this
in this way:

eval(parse(text=paste0(x[1, paste(rep(, , length(dim(x)) - 1), 
collapse=), ])))

Is it possible to avoid the eval parse here? How?

Best regards,

Martin

__
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] [Fw: Re: avoiding eval parse with indexing ]

2013-05-26 Thread Martin Ivanov
 ---BeginMessage---
 Dear Mr Gunter,

with a slight correction:
z - array(1:24,dim=2:4)
d - dim(z)
ix - lapply(d[-1], seq_len)
do.call([, c(list(z),1,ix))

[,1] [,2] [,3] [,4]
[1,]17   13   19
[2,]39   15   21
[3,]5   11   17   23

your suggestion worked and is exactly what I wanted! 
Thank You very much indeed!

I want to get rid of all eval(parse) constructs in my code,
and this was the greatest obstacle I had. Now I will be able to do this.
As they say, eval parse in the code is just lack on knowledge.

Best regards,

Martin


  Оригинално писмо 
 От:   Florent D.  
 Относно: Re: [R] avoiding eval parse with indexing
 До: Bert Gunter 
 Изпратено на: Неделя, 2013, Май 26 18:07:26 EEST
 
 
 library(abind)
 asub(x, 1, 1)
 
 On Sun, May 26, 2013 at 10:43 AM, Bert Gunter  wrote:
  Martin:
 
  Well, assuming I understand, one approach would be to first get the
  dim attribute of the array and then create the appropriate call using
  that:
 
  z - array(1:24,dim=2:4)
  d - dim(z)
  ix -lapply(d[-c(1,1)],seq_len)
   do.call(quot;[quot;, c(list(z),1,1,ix))
  [1]  1  7 13 19
 
  Is that what you want?
 
  -- Bert
 
 
 
  On Sun, May 26, 2013 at 6:56 AM, Martin Ivanov  wrote:
   Hello,
  I would like to get an advice on how the notorious eval(parse()) construct 
  could possibly
  be avoided in the following example. I have an array x, which can have 
  different number of dimensions,
  but I am only interested in extracting, say, the first element of the 
  first dimension. Currently I achieve this
  in this way:
 
  eval(parse(text=paste0(quot;x[1quot;, paste(rep(quot;, quot;, 
  length(dim(x)) - 1), collapse=quot;quot;), quot;]quot;)))
 
  Is it possible to avoid the eval parse here? How?
 
  Best regards,
 
  Martin
 
  __
  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.
 
 
 
  --
 
  Bert Gunter
  Genentech Nonclinical Biostatistics
 
  Internal Contact Info:
  Phone: 467-7374
  Website:
  http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
 
  __
  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.
 ---End Message---
__
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] avoiding eval parse with indexing

2013-05-26 Thread Martin Ivanov
 
Dear Arun,

Thank You very much, your suggestion also works and seems to also be more 
convenient.
I think though, that Mr Gunter's suggestion should be more efficient, as it 
uses directly the Extract operator.

Thank You all very much for Your responsiveness. R does have a wonderful 
community!

Best regards,
Martin



  Оригинално писмо 
 От:  arun 
 Относно: Re: [R] avoiding eval parse with indexing
 До: Martin Ivanov 
 Изпратено на: Неделя, 2013, Май 26 18:48:33 EEST
 
 
 Hi,
 You could use:
 library(abind)
 #using Berend's and Bert's example
 x1 - array(runif(9),dim=c(3,3))
 x2 - array(runif(8),dim=c(2,2,2))
 z - array(1:24,dim=2:4)
 #applying your code:
  
 eval(parse(text=paste0(quot;x1[1quot;,paste(rep(quot;,quot;,length(dim(x1))-1),collapse=quot;quot;),quot;]quot;)))
 #[1] 0.6439062 0.7139397 0.6017418
 eval(parse(text=paste0(quot;x2[1quot;,paste(rep(quot;,quot;,length(dim(x2))-1),collapse=quot;quot;),quot;]quot;)))
 #    [,1]  [,2]
 #[1,] 0.026671344 0.2116831
 #[2,] 0.003903368 0.1551140
 eval(parse(text=paste0(quot;z[1quot;,paste(rep(quot;,quot;,length(dim(z))-1),collapse=quot;quot;),quot;]quot;)))
 # [,1] [,2] [,3] [,4]
 #[1,]    1    7   13   19
 #[2,]    3    9   15   21
 #[3,]    5   11   17   23
 
  asub(x1,1,1,drop=TRUE)
 #[1] 0.6439062 0.7139397 0.6017418
  asub(x2,1,1,drop=TRUE)
 #    [,1]  [,2]
 #[1,] 0.026671344 0.2116831
 #[2,] 0.003903368 0.1551140
  asub(z,1,1,drop=TRUE)
 # [,1] [,2] [,3] [,4]
 #[1,]    1    7   13   19
 #[2,]    3    9   15   21
 #[3,]    5   11   17   23
 A.K. 
 
 
 
 - Original Message -
 From: Martin Ivanov 
 To: r-help@r-project.org
 Cc: 
 Sent: Sunday, May 26, 2013 9:56 AM
 Subject: [R] avoiding eval parse with indexing
 
 Hello,
 I would like to get an advice on how the notorious eval(parse()) construct 
 could possibly 
 be avoided in the following example. I have an array x, which can have 
 different number of dimensions,
 but I am only interested in extracting, say, the first element of the first 
 dimension. Currently I achieve this
 in this way:
 
 eval(parse(text=paste0(quot;x[1quot;, paste(rep(quot;, quot;, 
 length(dim(x)) - 1), collapse=quot;quot;), quot;]quot;)))
 
 Is it possible to avoid the eval parse here? How?
 
 Best regards,
 
 Martin
 
 __
 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] mcmapply should be parallel, but runs serial?

2013-05-11 Thread Martin Ivanov
 Dear all,

I am running R-3.0 on Slackware64 Linux (Linux marto 2.6.38.4 #1 SMP Thu Apr 21 
20:48:11 CDT 2011 x86_64 Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz GenuineIntel 
GNU/Linux)

Here is a minimal example:

library(parallel);
fun - function(fileName) { file.create(fileName); Sys.sleep(time=120); }
mcmapply(fileName=c(mcm1, mcm2), FUN=fun, mc.cores=2);
mclapply(X=c(mcl1, mcl2), FUN=fun, mc.cores=2);

Just compare the time stamps of the mcm* and mcl* files. You will see that
while the mcl* files have equal time stamps, i.e. they have been created 
simultaneously,
the mcm files are created one after the other, with exactly 120 seconds of 
difference.
This is what I see on my machine:

bash-4.1$ ls -l mcm*
-rw-r--r-- 1 marto users 0 May 11 14:25 mcm1
-rw-r--r-- 1 marto users 0 May 11 14:27 mcm2
bash-4.1$ ls -l mcl*
-rw-r--r-- 1 marto users 0 May 11 14:29 mcl1
-rw-r--r-- 1 marto users 0 May 11 14:29 mcl2


Any ideas?

Best regards,

Martin

__
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] cannot compile R on Cray XE6 HLRS HERMIT

2013-04-29 Thread Martin Ivanov
 Dear All,

I am trying to compile R-3.0 on Cray xe6 (HLRS) HERMIT, no success so far.
Here is my experience:

I use this to configure and make R:

CC=cc \
CXX=CC \
F77=ftn \
FC=ftn \
CPPFLAGS=-I$PREFIX/include \
LDFLAGS=-L$PREFIX/lib${LIBDIRSUFFIX} \
./configure --prefix=$PREFIX \
--exec-prefix=$PREFIX \
--bindir=$PREFIX/bin \
--sbindir=$PREFIX/sbin \
--sysconfdir=$PKG/etc \
--localstatedir=$PKG/var \
--libdir=$PREFIX/lib${LIBDIRSUFFIX} \
--datarootdir=$PREFIX/share \
--datadir=$PREFIX/share \
--infodir=$PREFIX/info \
--mandir=$PREFIX/man \
--docdir=$PREFIX/doc/$PRGNAM-$VERSION \
rdocdir=$PREFIX/doc/$PRGNAM-$VERSION \
rincludedir=$PREFIX/include \
rsharedir=$PREFIX/share \
--disable-BLAS-shlib \
--with-blas \
--with-lapack \
--without-x \
|| exit 1

make || exit 1

My environment is as follows:

  1) modules/3.2.6.7 13) 
udreg/2.3.2-1.0401.5929.3.3.gem 25) 
configuration/1.0-1.0401.35391.1.2.gem
  2) xtpe-network-gemini 14) ugni/4.0-1.0401.5928.9.5.gem   
 26) hosts/1.0-1.0401.35364.1.115.gem
  3) xtpe-interlagos 15) pmi/4.0.1-1..9421.73.3.gem 
 27) lbcd/2.1-1.0401.35360.1.2.gem
  4) cray-mpich2/5.6.4   16) 
dmapp/3.2.1-1.0401.5983.4.5.gem 28) 
nodehealth/5.0-1.0401.38460.12.18.gem
  5) eswrap/1.0.917) 
gni-headers/2.1-1.0401.5675.4.4.gem 29) pdsh/2.26-1.0401.37449.1.1.gem
  6) torque/2.5.918) xpmem/0.1-2.0401.36790.4.3.gem 
 30) shared-root/1.0-1.0401.37253.3.50.gem
  7) moab/6.1.5.s199219) 
job/1.5.5-0.1_2.0401.35380.1.10.gem 31) switch/1.0-1.0401.36779.2.72.gem
  8) system/ws_tools 20) 
csa/3.0.0-1_2.0401.37452.4.50.gem   32) xe-sysroot/4.1.40
  9) system/hlrs-defaults21) 
dvs/1.8.6_0.9.0-1.0401.1401.1.120   33) atp/1.6.2
 10) xt-asyncpe/5.19 22) rca/1.0.0-2.0401.38656.2.2.gem 

 11) gcc/4.7.2   23) 
audit/1.0.0-1.0401.37969.2.32.gem 
 12) xt-libsci/12.0.01   24) ccm/2.2.0-1.0401.37254.2.142

1. PrgEnv-gnu/4.1.40
checking for C libraries of cc -std=gnu99...  
-L/univ_2/ws3/ws/ipmiva-WRF_331_CORDEX-0/system/usr/lib64 
-L/opt/cray/udreg/2.3.2-1.0401.5929.3.3.gem/lib64 
-L/opt/cray/ugni/4.0-1.0401.5928.9.5.gem/lib64 
-L/opt/cray/pmi/4.0.1-1..9421.73.3.gem/lib64 
-L/opt/cray/dmapp/3.2.1-1.0401.5983.4.5.gem/lib64 
-L/opt/cray/xpmem/0.1-2.0401.36790.4.3.gem/lib64 
-L/opt/cray/rca/1.0.0-2.0401.38656.2.2.gem/lib64 
-L/opt/cray/mpt/5.6.4/gni/mpich2-gnu/47/lib 
-L/opt/cray/libsci/12.0.01/gnu/47/interlagos/lib 
-L/opt/cray/xe-sysroot/4.1.40/usr/lib64 -L/opt/cray/xe-sysroot/4.1.40/lib64 
-L/opt/cray/xe-sysroot/4.1.40/usr/lib/alps -L/usr/lib/alps 
-L/opt/gcc/4.7.2/snos/lib/gcc/x86_64-suse-linux/4.7.2 
-L/opt/gcc/4.7.2/snos/lib/gcc/x86_64-suse-linux/4.7.2/../../../../lib64 
-L/lib/../lib64 -L/usr/lib/../lib64 
-L/opt/gcc/4.7.2/snos/lib/gcc/x86_64-suse-linux/4.7.2/../../.. -lrca 
-L/opt/cray/atp/1.6.2/lib/ -lAtpSigHCommData -lAtpSigHandler -lgfortran 
-lscicpp_gnu -lsci_gnu_mp -lstdc++ -lmpich_gnu_47 -lmpl -lrt 
 -lxpmem -ldmapp -lugni -lpmi -lalpslli -lalpsutil -ludreg -lpthread -lm -lgomp 
-lgcc_eh
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no 
extra underscore
checking whether ftn appends underscores to external names... yes
checking whether ftn appends extra underscores to external names... no
checking whether mixed C/Fortran code can be run... yes
checking whether ftn and cc -std=gnu99 agree on int and double... configure: 
WARNING: ftn and cc -std=gnu99 disagree on int and double
configure: error: Maybe change CFLAGS or FFLAGS?

2. PrgEnv-gnu/4.1.40 + craype-target-native

R is now configured for x86_64-unknown-linux-gnu

  Source directory:  .
  Installation directory:/univ_2/ws3/ws/ipmiva-WRF_331_CORDEX-0/system/usr

  C compiler:cc -std=gnu99  -g -O2
  Fortran 77 compiler:   gfortran  -g -O2

  C++ compiler:  CC  -g -O2
  Fortran 90/95 compiler:ftn -g -O2
  Obj-C compiler:

  Interfaces supported:
  External libraries:readline
  Additional capabilities:   JPEG
  Options enabled:   shared R library, shared BLAS, R profiling, memory 
profiling, strict barrier, static HTML

  Recommended packages:  yes

nmath/*.o` ../extra/zlib/libz.a ../extra/bzip2/libbz2.a ../extra/pcre/libpcre.a 
../extra/tre/libtre.a  ../extra/xz/liblzma.a  -L../../lib -lRblas -lgfortran 
-lm -lquadmath   -lreadline -lncurses  -lrt -ldl -lm
make[4]: Entering directory 
`/univ_2/ws3/ws/ipmiva-WRF_331_CORDEX-0/build/tmp/R-3.0.0/src/main'
mkdir -p -- /univ_2/ws3/ws/ipmiva-WRF_331_CORDEX-0/build/tmp/R-3.0.0/bin/exec
make[4]: Leaving directory 
`/univ_2/ws3/ws/ipmiva-WRF_331_CORDEX-0/build/tmp/R-3.0.0/src/main'
make[3]: Leaving 

[R] lattice: ticks at the joining sides of panels?

2013-02-26 Thread Martin Ivanov
 Dear R users,

I would like to produce a lattice graph that keeps the ticks at the joining 
sides of the panels.
For example:

library(lattice)
library(datasets)
xyplot(lat ~ long | cut(depth, 2), data = quakes, between=list(x=1))

You can see that ticks are plotted at the sides 1 (bottom), 2 (right) and 3 
(top) of panel 1
and 1 (bottom), 3 (top) and 4 (right) of panel 2. Is it possible to plot ticks 
at side
4 (right) of panel 1 and side 2 (left) of panel 2?

Thank You very much for Your attention.

Best regards,

Martin

__
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] non-overlapping blocks bootstrap?

2013-02-06 Thread Martin Ivanov
 
Dear Rafael,

Thank You very much for Your reply.

I need to use non-overlapping blocks and such that each block ends with an 
element having an index multiple of 3 in the original series.
For example if I have the numbers:  1 2 3 4 5 6 7 8 9, the samples I could take 
are:

123 456 789, 456 789 123, 789 123 456, 789 456 123, 456 123 789 and 123 789 
456. 
As You see, the blocks must contain consecutive elements from the original 
sample.

The reason why I need exactly that resampling is that my data are monthly and 
are stratified by season. So in effect my time series looks like this,
e.g. for the summer:

1 2 34 5 6 7 8 9   10 11 12  ... : the indices in the data
J J AJ J A J J A   J  J  A    : the months
19891990   1991 1992    : the years

and so on. So the block size of 3 is naturally determined by the nature of my 
data. I assume the interannual correlations are negligible compared to the 
intraseasonal ones and neglect the former. 


Best regards,

Martin


  Оригинално писмо 
 От:  Rafael Robledo 
 Относно: Re: [R] non-overlapping blocks bootstrap?
 До: Martin Ivanov 
 Изпратено на: Вторник, 2013, Февруари 5 23:57:52 EET
 
 
 If you only need to take blocks of a defined size from a time series,
 you may use sample function (which default behavior is to sample
 without replace).
 
 For example:
 
 tt - 1:24
 ss - sample(tt, replace=F)
 
 bs - 3
 nb - length(tt) / bs
 
 res - split(ss, rep(1:nb, each=bs))
 
 Hope this helps,
 
 
 On Tue, Feb 5, 2013 at 8:28 AM, Martin Ivanov  wrote:
   Dear R users,
 
  I need to perform a block bootstrap to a time series. The block size must 
  be 3 and the blocks must NOT overlap.
  I found a number of functions for bootstrap in R (tsboot, tsbootstrap in 
  tseries, and LocSig in SpatialVx), but neither of them seems to implement 
  non-overlapping blocks. Is there a way to perform a bootstrap with 
  non-overlapping fixed-size blocks in R?
 
  Best regards,
 
  Martin
 
  __
  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.
 
 
 
 --
 Rafael Robledo J.
 
 On Tue, Feb 5, 2013 at 8:28 AM, Martin Ivanov  wrote:
   Dear R users,
 
  I need to perform a block bootstrap to a time series. The block size must 
  be 3 and the blocks must NOT overlap.
  I found a number of functions for bootstrap in R (tsboot, tsbootstrap in 
  tseries, and LocSig in SpatialVx), but neither of them seems to implement 
  non-overlapping blocks. Is there a way to perform a bootstrap with 
  non-overlapping fixed-size blocks in R?
 
  Best regards,
 
  Martin
 
  __
  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.
 
 
 
 -- 
 Rafael R.
 

__
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] non-overlapping blocks bootstrap?

2013-02-05 Thread Martin Ivanov
 Dear R users,

I need to perform a block bootstrap to a time series. The block size must be 3 
and the blocks must NOT overlap. 
I found a number of functions for bootstrap in R (tsboot, tsbootstrap in 
tseries, and LocSig in SpatialVx), but neither of them seems to implement 
non-overlapping blocks. Is there a way to perform a bootstrap with 
non-overlapping fixed-size blocks in R?

Best regards, 

Martin

__
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] print and cat not working with parallelised functions?

2012-12-08 Thread Martin Ivanov
 Dear R Community,

I am running R version 2.15.2 with package parallel version 2.15.2.
The problem is that cat and print do not produce any output. Also assigning 
objects to the .GlobalEnv does not work. This makes it difficult for me to 
debug code. This can be seen from the
following minimal working example:

library(parallel)
fun2 - function(x) {
b - x; # try to export the object to the workspace
print(x); # try to print x
}

fun1 - function(d) {
 cl - makeCluster(getOption(cl.cores, detectCores()));
 parSapply(cl=cl, X=seq_along(d), FUN=fun2);
 stopCluster(cl=cl);
}
fun3 - function(d) sapply(X=seq_along(d), FUN=fun2); 
fun1(d=1:5)
a - fun3(d=1:5)

print only works when fun3 is called, that is when there is no parallelisation. 
The
same is also true for the - assignment.
I am almost sure this is not a bug, but a feature, so I would like to ask you
for some explanation and also for some ideas how to handle debugging code when 
no printing or exporting objects to the workspace works.

Any suggestions will be appreciated.

Best regards,

Martin Ivanov

__
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] get: problem with environments

2012-10-12 Thread Martin Ivanov
 Dear Prof. Lumley,

Thank You very much for Your reply. I implemented Your idea 
not to directly call get from sapply, but inside a function, supplied to sapply.
In this way the 3-rd parent frame is always the correct one, no matter 
whether I invoke testfun2()
all by itself or inside another function. So my code is finally stable.

It is quite tricky that when I call get() directly from sapply(), like this:
sapply(X=, FUN=get, envir=parent.frame()), actually envir is an argument not to 
get, but to
sapply, so it is evaluated in the environment of the caller, i.e. in the 
environment of testfun1, whose parent is the workspace, which of course does not
contain the variables in the body of testfun1. In testfun2() sapply() calls 
get()
from within a function and the envir argument to get() is supplied directly to 
it, i.e.
it is evaluated in the environment of get(). Its first parent is the 
environment of the function calling get(), its second parent is the environment 
of sapply() and its third parent is the environment of testfun2(), which I 
need. That is why testfun2() works. 

I hope I have correctly understood this matter. Please correct me if I am wrong.

Nevertheless the code is finally stable and it is thanks to Your suggestion.

Best regards,

Martin Ivanov


  Оригинално писмо 
 От:  Thomas Lumley 
 Относно: Re: [R] get: problem with environments
 До:  R. Michael Weylandt  
 Изпратено на: Четвъртък, 2012, Октомври 11 01:52:14 EEST
 
 
 On Thu, Oct 11, 2012 at 11:18 AM, R. Michael Weylandt
  wrote:
 
  Thanks Prof Lumley,
 
  I'm still not sure how this gets to the call stack of 5 or 6 the OP
  reported or the difference between GUI amp; Terminal. Any thoughts there?
 
 I don't see how the terminal version is getting 5 and 6 rather than 1
 and 2, but my testfun2() lets the OP do what he was originally trying
 to do.
 
 The difference between testfun() and print(testfun()) (ie, 1 vs 2, or
 5 vs 6) is because of lazy evaluation: in print(testfun()), testfun()
 is called from inside print() when it needs the value to do method
 dispatch.
 
 I can't reproduce the value of 5, so I can't help much. For anyone
 wanting to experiment further, it would probably be simpler to use
 
 testfun-function() sys.nframe()
 
 rather than looking at whether a variable is found or not.  I can't
 see how testfun() typed at the global command prompt can return
 anything other than 1, but maybe something is getting in between the
 console and the evaluator.  For example:
  testfun()
 [1] 1
  print(testfun())
 [1] 2
  capture.output(testfun())
 [1] quot;[1] 6quot;
 
 I don't see why a pure console program should do this on Linux, though.
 
-thomas
 
 
 -- 
 Thomas Lumley
 Professor of Biostatistics
 University of Auckland
 

__
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] get: problem with environments

2012-10-07 Thread Martin Ivanov
 Dear R users,

I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working 
example:

testfun - function (x) {
 a - 0;
 sapply(X=a, FUN=get, envir=sys.frame(which=x));
}

Inside R, that is R called from within a Linux terminal, the following code 
works:
testfun(x=5)
print(testfun(x=6))
But within rkward the above code fails and the following works:
testfun(x=1)
print(testfun(x=2))

As you can see, the number of contexts up the call stack that contain the 
variable a
varies depending on the implementation. If I call testfun() from within 
print(), I have to go 
one context up the call stack than if I call testfun() alone by itself. This 
implies 
some inherent instability of my code. 

Actually I need to provide get() access to the calling environment of sapply().
According to the documentation of parent.frame(), The parent frame of a 
function evaluation is the environment in which the function was called. I 
tried to use parent.frame() instead of sys.frame() above,
but the variable a is never found, regardless of what value I give to the 
parameter n of 
parent.frame().

I have basically three questions:

1. Do You have an idea how I could implement the code 
more stably, so that the variable a is always visible to get, regardless of 
whether testfun
is used alone by itself or called from within another function?

2. Why does the implementation with parent.frame() not work?

3. Why does the number of contexts in the call stack differ in R and in rkward? 
It seems that when R is called from within the Linux terminal the call stack 
contains 4 contexts more that it does when is called from rkward. This also 
points to the instability of the code which I would like to solve.

Any suggestions on any on the above questions will be greatly appreciated.

Best regards,

Martin

__
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] get: problem with environments

2012-10-07 Thread Martin Ivanov
 Thank You very much for Your replies.
Dear Michael,

Does this persist after a new session (perhaps running as R --vanilla) and/or 
reinstall?
Yes, it does. After running R --vanilla, still there are 4 contexts more on the 
call stack.
 
You didn't show us how you tried to use parent.frame()
I did it like this:
testfun1 - function (x1) {
 a1 - 1;
 sapply(X=a1, FUN=get, envir=parent.frame(x1));
}

testfun1(x1=1);

The above code never succeeds no matter what a number I give to x1.

 3. Why does the number of contexts in the call stack differ in R and in 
rkward?
 It shouldn't. This is an issue that needs further sorting out.

Here is some more info on my setup:
sessionInfo()   
R version 2.15.1 (2012-06-22)
Platform: x86_64-slackware-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US   LC_NUMERIC=C LC_TIME=en_US   
 [4] LC_COLLATE=C LC_MONETARY=en_USLC_MESSAGES=en_US   
 [7] LC_PAPER=C   LC_NAME=CLC_ADDRESS=C
[10] LC_TELEPHONE=C   LC_MEASUREMENT=en_US LC_IDENTIFICATION=C 

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

loaded via a namespace (and not attached):
[1] tools_2.15.1


Best regards,

Martin

__
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] cannot allocate a vector of size error, what explodes the the memory consumption?

2012-08-11 Thread Martin Ivanov
 Dear R users,

I keep getting the message Error: cannot allocate a vector of size 543.2 Mb 
on my 64 bit Linux machine with 4 Gb of memory. I studied the problem and it 
occurs at the last lines of my code:

..
a - laply(.);
save(a, file= file.RData);
rm(a);

a is a 4-d array of size about 600 Mb. 3 minutes before R exits and displays 
the error message, the 
memory consumption of R (diagnosed with top) is 1.8 Gb. 2 minutes before the 
error, the memory consumption of R suddenly expands to 2.8 Gb and one minute 
before the error it is 3 Gb. This is why I suspect the problem 
is with my code. I have checked the same code with smaller data sets, it works 
perfectly. But with larger data sets, that is when the size of a gets bigger 
than, say, about 500 Mb, I get the error. 
Actually 99% of the time the memory consumption is up to 1.8 Gb. This is while 
things are going within laply.
And at the end, at these 3 last lines something causes more than doubling of 
the R memory consumption.
Have you got any idea what the culprit is?

Any suggestions will be appreciated.

Best regards,
Martin

-
Гражданска отговорност – Цените на компаниите
http://www.sdi.bg/onlineInsurance/?utm_source=gbgutm_medium=txtLinkutm_content=home

__
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] contour line labels in trellis contourplot

2012-07-21 Thread Martin Ivanov
 Hello,
In the classical function contour labels are drawn so that each contour line 
is broken at the place of the label, so that the label does not overlap the 
line. In the trellis contoourplot the labels are placed beside or over the 
line, controlled by the label.style parameter, but I could not find
an option that would place the labels just as in the classical contour: 
breaking the contour line to make place for the label.

Have You got any ideas how breaking the contours to make place for the labels 
could be achieved in a trellis contourplot? 

Best regards,

Martin

__
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] why does this simple example NOT work?

2012-07-20 Thread Martin Ivanov
 Hello,

I want to create and save objects in a loop, but this is precluded by the 
following obstacle:
this part of the script fails to work:

assign(x=paste(a, 1, sep=), value=1);
save(paste(a, 1, sep=), file=paste(paste(a, 1, sep=), .RData, sep=))

Do you know any workaround? I am already out of ideas.

Best regards,

Martin

__
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] overlay contourplot with labels over spplot with color regions?

2012-07-20 Thread Martin Ivanov
 Dear R users,

I have the following problem. I plot a SpatialPixelsDataFrame object with 
spplot and I need to add a contourplot
of another spatial variable. To be more precise, I plot the  
SpatialPixelsDataFrame of the mean precipitation over Germany with coloured 
regions and I want to overlay the isolines of the 500, 1000 and 1500 m height 
above sea level. Of course I can plot the lines as SpatialLines using the 
sp.layout argument to spplot, but so I lose the labels on the lines. And I want 
the height above sea level to be labelled just as it is labelled in a contour 
plot. Is it possible to achieve that with lattice? 

I am still new to lattice, so I beg Your excuse in case I am asking something 
trivial. I googled a lot and tried a lot of things, but none worked. I tried 
with contour, it does work with Spatial objects, but unfortunately contour does 
not seem work with lattice. And the lattice equivalent contourplot does not 
recognise Spatial objects. 

I am already out of ideas. I am looking forward to Your replies. Any 
suggestions will be appreciated.

Best regards,

Martin

__
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] contour lines with number labels in lattice?

2012-07-18 Thread Martin Ivanov
 Dear R users,

I am new to lattice but am trying to get to grips with it. 
I need to add contour lines for the topography to a plot I created with spplot. 
The topography is available as a
SpatialPixelsDataFrame object Z_sfc. If I plot it as spatial lines, after 
converting to a SpatialLines object:
imageZ - as.image.SpatialGridDataFrame(x=Z_sfc);
cLZ - contourLines(x=imageZ$x, y=imageZ$y, z=imageZ$z, levels = 
pretty(range(imageZ$z, na.rm=TRUE), 5));
sldfZ_sfc - ContourLines2SLDF(cL=cLZ, proj4string=CRS(proj4string(Z_sfc)))
topography - list(sp.lines, sldfZ_sfc, first=FALSE, col=black);

and then using the sp.layout=topgraphy argument to spplot, I lose the number 
labels on the lines. 
Is it possible in lattice to print the height of the isolines just as it is 
printed with contour?

I tried with contour, it does work with SpatialPixelsDataFrame, but 
unfortunately contour does not seem work with lattice. And the lattice 
equivalent contourplot does not recognise SpatialPixelsDataFrame objects. Is it 
possible somehow to add a contour plot of Z_sfc to my plot?


Many thanks in advance.

Martin

__
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] tck = 0 for the colorkey?

2012-07-13 Thread Martin Ivanov
 Dear R users,

I am struggling with the colorkey on a levelplot lattice graphic.
I want that no ticks are printed on the colorkey. That is, I want their size 
tck=0.
Merely setting tck=0 t in the colorkey parameter does not work. Setting it in 
the lattice.par.set()
removes the ticks from the levelplot, but not from the colorkey. 

Any suggestions will be appreciated.

Best regards,

Martin


-
Гражданска отговорност – Цените на компаниите
http://www.sdi.bg/onlineInsurance/?utm_source=gbgutm_medium=txtLinkutm_content=home

__
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] minor axis ticks in trellis graphics?

2012-07-13 Thread Martin Ivanov
 Dear R users,

I need to add minor axis ticks to my graph. In traditional R this is easily 
achievable by simply
adding a second axis with the minor ticks. But how to do that in trellis? I am 
already out of ideas.

Any suggestions will be appreciated.

Best regards,

Martin

-
Гражданска отговорност – Цените на компаниите
http://www.sdi.bg/onlineInsurance/?utm_source=gbgutm_medium=txtLinkutm_content=home

__
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] trellis margin sizes in absolute units

2012-07-12 Thread Martin Ivanov
 Dear R users,

I have a lot of experience with traditional R graphics, but I decided to turn 
to trellis as
it was recommended for spatial graphs by the sp package. In traditional R 
graphics
I always first set the size of the device region absolute units (e.g.  mm) and 
then I
firmly fix the inner margins with mai and the outer margins with oma also in 
absolute units.
What is left from the device region is for the plot region. That is my general 
idea.

My question is, is it possible to achieve that full control with trellis 
graphics? I have tried 
with the *.paddings parameters, but it seems to me that the margins are still 
larger than I have set them.
Here is my example code: (mp is a SpatialPixelsDataFrame)

xlim - c(.96*bbox(mp)[1, 1], 1.02*bbox(mp)[1, 2]);
ylim - c(.992*bbox(mp)[2, 1], 1.005*bbox(mp)[2, 2]);
b - 1; t - 2; # b, t : should be bottom and top figure margins
l - 1; r - 6; # l, r : should be left and right figure margins
asp - mapasp(data=mp, xlim=xlim, ylim=ylim);
# I have set the width of the device region as w millimetres and here I 
calculate 
# its height, taking care of the aspect ratio
h - b + t + asp*(w - (l + r));

postscript(output, onefile=FALSE, paper=special, width=w/25.4, height=h/25.4, 
horizontal=FALSE, fonts=c(Times), print.it=FALSE, colormodel=rgb, 
pointsize=12);

# here I set all the possible paddings to make sure that all other margins are 
0:
trellis.par.set(layout.widths=list(left.padding=l, right.padding=r, 
key.ylab.padding = 0,
ylab.axis.padding = 0, axis.key.padding = 0, units=mm),
layout.heights=list(bottom.padding=b, top.padding=t, main.key.padding = 0, 
key.axis.padding = 0, axis.xlab.padding = 0,
xlab.key.padding = 0, key.sub.padding = 0, units=mm),
axis.components=list(bottom=list(pad1=.8), left=list(pad1=.8)));

But still, the resulting margins are larger than I expect and to achieve the 
desired effect I have to set some parameters to negative numbers. So I guess 
there are some other graphical parameters that come into play, about which I do 
not know. 
Which margins are these *.padding parameters controlling: the outer (device) or 
the inner (figure) margins?

Any suggestions will be appreciated.

Regards,
Martin


-
Гражданска отговорност – Цените на компаниите
http://www.sdi.bg/onlineInsurance/?utm_source=gbgutm_medium=txtLinkutm_content=home

__
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] number of decimal places in a number?

2012-07-10 Thread Martin Ivanov
 
Dear R users,

Thank You very much for Your responsiveness. I think the suggestion of arun's 
modification of Josh's code works best and it is what I am going to implement.

Cite Ellison:
Surely the issue is not the particular numeric resolution of the numbers but 
the idea that the bounding box limits should be integer multiples of the 
resolution?
Is that not accomplished more straightforwardly by things like
min - resol * floor( min(lat)/resol )
max - resol * ceil( max(lat)/resol )
?
Dear Ellison,
not the bounding box limits, but the bounding box RANGE needs to be an integer 
multiple of the resolution, that is max-min=ineger*resolution. The bbox limits 
must just be rounded to the same number of digits as the resolution and include 
all available values, of course.

Best regards.



  Оригинално писмо 
 От:  arun 
 Относно: Re: [R] number of decimal places in a number?
 До:  ted.hard...@wlandres.net  
 Изпратено на: Събота, 2012, Юли 7 22:50:03 EEST
 
 
 Hi, 
 
 
 I checked the count for the cases (A) and (F) with a variant of Josh's 
 function:
 
 decimalnumcount-function(x){stopifnot(class(x)==quot;characterquot;)
  x-gsub(quot;(.*)(#92;#92;.)|([0]*#36;)quot;,quot;quot;,x)
  nchar(x)
  }
  A) 
 x-quot;123456789.123456789quot;
  decimalnumcount(x)
 #[1] 9
 
 x-quot;923456789.123456789quot;
 decimalnumcount(x)
 #[1] 9
 
 B)
  x-quot;0.012345quot;
  decimalnumcount(x)
 #[1] 10
 
 
 c)
 x - c(quot;3.14quot;, quot;3.142quot;, quot;3.1400quot;, 
 quot;123456.123456789quot;, quot;123456789.123456789quot;,pi,sqrt(2))
   decimalnumcount(x)
 #[1]  2  3  2  9  9 14 13
 x
 [1] quot;3.14quot;    quot;3.142quot;   
 quot;3.1400quot; 
 [4] quot;123456.123456789quot;    quot;123456789.123456789quot; 
 quot;3.14159265358979quot;   
 [7] quot;1.4142135623731quot;    
 
 
 
 D)
  x - c(3.14, 3.142, 3.1400, 123456.123456789, 123456789.123456789,pi,sqrt(2))
 decimalnumcount(as.character(x) )
 [1]  2  3  2  9  6 14 13
 #as.character(x)
 #[1] quot;3.14quot; quot;3.142quot;    
 quot;3.14quot; quot;123456.123456789quot;
 #[5] quot;123456789.123457quot; quot;3.14159265358979quot; 
 quot;1.4142135623731quot; 
 
 E)
 print(pi,22)
 #[1] 3.141592653589793115998
 print(sqrt(2),22)
 #[1] 1.414213562373095145475
     x - c(quot;3.14quot;, quot;3.142quot;, quot;3.1400quot;, 
 quot;123456.123456789quot;, 
 quot;123456789.123456789quot;,quot;3.141592653589793115998quot;,quot;1.414213562373095145475quot;)
  decimalnumcount(x)
 #[1]  2  3  2  9  9 21 21
 
 F) 
 formatC(pi,format=quot;fquot;,digits=22)
 #[1] quot;3.1415926535897931159980quot;
  formatC(sqrt(2),format=quot;fquot;,digits=22)
 #[1] quot;1.4142135623730951454746quot;
 
  x - c(quot;3.14quot;, quot;3.142quot;, quot;3.1400quot;, 
 quot;123456.123456789quot;, 
 quot;123456789.123456789quot;,formatC(pi,format=quot;fquot;,digits=22),formatC(sqrt(2),format=quot;fquot;,digits=22))
  decimalnumcount(x)
 #[1]  2  3  2  9  9 21 22
 
 
 G)
 #  formatC() didn't show the limitations of print() 
  print(sqrt(2),22)
 #[1] 1.414213562373095145475
 
 print(sqrt(2),35)
 #Error in print.default(sqrt(2), 35) : invalid 'digits' argument
 
 formatC(sqrt(2),35)
 #[1] quot;1.4142135623730951454746218587388285quot;
 or,
 formatC(sqrt(2),format=quot;fquot;,digits=35)
 #[1] quot;1.41421356237309514547462185873882845quot;
 
 
 #using 22
 
 x - c(quot;3.14quot;, quot;3.142quot;, quot;3.1400quot;, 
 quot;123456.123456789quot;, 
 quot;123456789.123456789quot;,formatC(pi,format=quot;fquot;,digits=35),formatC(sqrt(2),format=quot;fquot;,digits=50))
  decimalnumcount(x)
 #[1]  2  3  2  9  9 35 50
 
 
 
 
 So, I guess it will be better to deal with character strings rather than 
 using as.character.
 A.K.
 
 
 
 
 - Original Message -
 From: quot;ted.hard...@wlandres.netquot; 
 To: r-help@r-project.org
 Cc: Martin Ivanov 
 Sent: Saturday, July 7, 2012 8:12 AM
 Subject: Re: [R] number of decimal places in a number?
 
 I had thought of also (as well as my numerical routing) suggesting
 a quot;gsub()quot; type solution like Joshua's below, but held back because
 the result could depend on how the number arose (keyboard input,
 file input, or from computation within R).
 
 However, I now also realise that (again because of binary rounding
 errors), the quot;gsub()quot; method has interesting differences from my
 numerical method. Example:
 
 [A] (as from my original method):
   f(123456789.123456789)
   # [1] 7
 
 [B] (the quot;gsub()quot; method)
   nchar(gsub(quot;(.*#92;#92;.)|([0]*#36;)quot;, quot;quot;, 
 as.character(123456789.123456789)))
   # [1] 6
 
 Now look at:
 
 [C] (what as.character() does to 123456789.123456789)
   as.character(123456789.123456789)
   # [1] quot;123456789.123457quot;
 
 [D] (quot;22quot; is the maximum number of decimal digits for print())
   print(123456789.123456789,22)
   # [1] 123456789.1234568
 
 So as.character() has rounded it to 6 decimal places (agreeing
 with [B]), while

[R] number of decimal places in a number?

2012-07-07 Thread Martin Ivanov
 Dear R users,

I need a function that gets a number and returns its number of actual decimal 
places.
For example f(3.14) should return 2, f(3.142) should return 3, f(3.1400) should 
also return 2
and so on. Is such function already available in R? If not, could you give me a 
hint how to achieve that?

Many thanks in advance.

-
Гражданска отговорност – Цените на компаниите
http://www.sdi.bg/onlineInsurance/?utm_source=gbgutm_medium=txtLinkutm_content=home

__
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] number of decimal places in a number?

2012-07-07 Thread Martin Ivanov
 Dear Mr Harding,

Thank You very much for Your responsiveness.

 There would seem to be no clean general solution to this
 question. An important issue would be: What use do you
 want to put the result to?
 
I need this trick for the following task.
I am writing a function which has to determine the bounding box for a 
spatial data set. The bounding box is a matrix(c(minLon minLat, maxLon, 
maxLat)).
I have the longitudes (lon) and latitudes (lat), and I have a resolution (r), 
for example 
r = 0.004. The bounding box must have the same number of digits as resolution. 
So I first have to truncate min(lon) and min(lat) to 3 decimal places,
then take the ceiling of max(lat)*10^3 and max(lon)*10^3 divided by 10^3. So I 
have the 
maximal interval with resolution r for each variable (lat or lon). Then I have 
to determine
the number of cells in each direction, which I take as 
ceiling((maxLat-minLat)/r) and
ceiling((maxLon-minLon)/r). Here is an example of my code:

 # get the first n digits from a number
truncf - function(x, digits) {
 # some control:
 for(i in c(x, digits)) if(!(is.numeric(get(i))  length(get(i)) == 1)) 
stop(i,  in truncatef must be a  numeric scalar!);
 ## make sure that digits is an integer:
 if(as.integer(digits) - digits) stop(Please provide an integer digits to 
truncf!);

 x - trunc(x*10^digits)/10^digits;
 x;
}
 for(i in 0:5) if(!(resolution*10^i - as.integer(resolution*10^i))) break;
 lonMin - truncf(x=min(lon), digits=i); lonMax - 
ceiling(x=max(lon)*10^i)/10^i;
 latMin - truncf(min(lat), digits=i); latMax - ceiling(x=max(lat)*10^i)/10^i;
 cells.dim - ceiling(c(lonMax - lonMin, latMax - latMin)/resolution);
 
 
I hope this sheds more light on my issue.

Best regards,
Martin

-
Гражданска отговорност – Цените на компаниите
http://www.sdi.bg/onlineInsurance/?utm_source=gbgutm_medium=txtLinkutm_content=home

__
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] triangles point left, filled?

2011-11-01 Thread Martin Ivanov
 Dear R users,

I want to plot not only triangles point up and triangles point down,
which is easy using the pch argument to points. I want to plot left and 
right pointing triangles as well. They must be fillable with colour.

I browsed a little in the documentation, tried rotating the up and down 
pointing triangles, but of no avail. Any suggestions will be appreciated.

Regards,
Martin Ivanov

-
100 лв БОНУС. Най-високи коефициенти. Tempobet.com
http://bg.tempobet.com/affiliates/3208311

__
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] alphahull: is low level plotting possible?

2011-06-16 Thread Martin Ivanov
 Dear R users,
I am using package alphahull version 0.2-0 with R-2.13.0. Here is my problem.
I have produced a 2-D plot of points and need to draw convex hulls around some 
subsets of these points. So I just need to add the convex hulls to the already 
existing plot. That is why I cannot use the plot.hull function. So, is there a 
way to just add the convex hulls to the already existing plot, just as the low 
level functions lines and points add lines and points to an already 
existing plot? I suspect the solution is in the arc function, but I am not 
sure.

Any suggestions will be appreciated.

Regards,

Martin

__
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] return NA instead zero when summing over an empty range?

2010-10-27 Thread Martin Ivanov
 Dear R users,

the colSums function from the base package returns zero if there are no values 
in a range to be summed over (after removing missing values with na.rm = TRUE). 
Is there some way to make it return NA in that case just like colMeans does? Or 
any other function or some good way to achieve that? Any ideas are be welcome.

Regards,
Martin Ivanov

-
Вижте последните новини във Vesti.bg!
http://www.vesti.bg/

__
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] 3d plot layout?

2010-09-08 Thread Martin Ivanov
 Hello!

I would like to ask if R can solve the following problem. 
I need to produce two 3d plots on a single page, that is
to arrange them one above the other. Also, I need to
 visualize points by means of spheres, pyramids and cubes
in the 3d space. Also, I would like to fill these symbols
with colours. Is this possible to be done with R?

In the two dimensional case the R plots are of excellent quality,
I use the layout function to arrange the plots and the symbols
from 20 to 25 that can be filled. So my question is can I produce
an analogous 3d plot with R?

Thank you in advance.

Regards, Martin

__
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] problem with abline and lines

2010-03-22 Thread Martin Ivanov
 Dear R users,

I need to plot to perpendicular straight lines. However, although I set the 
coefficients 
so that the lines are perpendicular, they do not look to be so in the plot. 
Here is a minimal working example:
plot(x=c(-1, 1), y=c(-1, 1)); abline(a=0, b=1/sqrt(2)); abline(a=0, 
b=-1/sqrt(2))

Please tell me if the same problem is valid by you. I am running R-2.10.1 on 
Linux.

Is there a way out of this?

Regards,

Martin

__
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] Is this a bug? (layout and par)

2010-02-15 Thread Martin Ivanov
 Dear R users, 

I think I have spotted a bug in R, but as I am not sure, I first post it to you.
Here is a minimal working example:

default - par(no.readonly=TRUE);
par(font=1, adj=0.5, cex=1, cex.lab=1, cex.axis=0.5, font.axis=2, lend=2, 
family=Times,
omi=c(0, 0, 0, 0))
layout(mat=matrix(data=1, nrow=1), widths=lcm(7.8), heights=lcm(.8), 
respect=FALSE);
par(mai=c(1, 9 + 20, 0, 1)/25.4);
plot(x=.5, y=.5, , xaxs=i, yaxs=i, type=n, xaxt=n, yaxt=n, asp=NA)
par(default);

As you can see there is a number 0.5 written in the left figure region, 
although all writing 
is explicitly suppressed. Moreover, if I modify the last but one command like 
this:
plot(x=.5, y=c(.5) , xaxs=i, yaxs=i, type=n, xaxt=n, yaxt=n, asp=NA)

the output in the left margin is c(0.5. Does anyone have an explanation? Is 
this a bug?
Can this problem be solved?

Regards, 

Martin Ivanov

__
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] coefs from summary.lm of an aov object

2010-02-04 Thread Martin Ivanov
 Dear R users, 

This is probably a very stupid question, nevertheless I obviously am not 
qualified enough
to cope with it. I do not understand what the coefficients are that are output 
by running 
summary.lm on an aov object. I thought they should be the differential effects 
for the levels of the factor and the overall mean, but they are obviously not, 
as illustrated by the following simple example:

x - c(1:15); y - factor(c(rep(a, 5), rep(b, 10)))
 tapply(X=x, INDEX=y, FUN=mean)
   ab 
 3.0 10.5 

 mean(x)
[1] 8

 a - aov(x ~ y)
 summary.lm(a)$coef
Estimate Std. Error  t value Pr(|t|)
(Intercept)  3.0   1.192928 2.514821 0.0258555905
yb   7.5   1.461032 5.133357 0.0001921826


 model.tables(a)
Tables of effects

 y 
 ab
-5  2.5
rep  5 10.0

Besides, I fit a factor with two levels, a and b, but there is only the 
yb coefficient for the b level, no ya coefficient for the a factor 
level. I read a lot of materials on anova with R, but I could not find what are 
these coefficients. I would be grateful if someone gives me some clue. And what 
is the intercept term? I though it should be the overall mean, but it is 
obviously not. 

Regards and best wishes,

Martin Ivanov

__
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] biplot from stats: 0.8 ?

2010-01-27 Thread Martin Ivanov
 Dear forum,
I need to create biplot graphic. I took a look at the code of the 
biplot.default function from the stats package and I found that the arrows for 
the variables are multiplied by a coefficient of 0.8 before plotting:
...
if (var.axes) 
arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], 
length = arrow.len)
...
 I have no idea why this is done. Could somebody clarify?

Thank you in advance.

Regards,
Martin

__
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] factor graphics with pca in R?

2010-01-07 Thread Martin Ivanov
 Dear R users, 
I need to know whether the factor graphics with principal component analysis 
are implemented in R. I mean the graphs where the variables are represented in 
a correlation circle, as described in more detail in this document: 
http://www.unesco.org/webworld/idams/advguide/Chapt6_4_3.htm

It is not a pain to program it myself, nevertheless it would be a waste of time
 if it is already implemented in R. 

Regards, 
Martin

__
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] utf8 postscript cyrillic

2009-12-20 Thread Martin Ivanov
 Dear R users,

I am running R version 2.10.0 (2009-10-26). I need to prepare an eps
graphic with a legend with cyrillic words. I tried setting the encoding
parameter of the postscript command, but in vain, nothing seems to work. I
tried with CP1251, KOI8-R, UTF-8 and Cyrillic (UTF-8 turned out to not be
available under /usr/lib/R/library/grDevices/enc). All I get is 
in the final inscription.

Has someone been successful in producing postscript legends with cyrillic
words and how? Is the encoding the only thing to be tweaked?

I would be glad if you share your experience.

Regards,
Martin

__
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 question on type=h plot lines

2009-05-24 Thread Martin Ivanov
Dear R users,
I need a produce a plot with a single panel and a few lines on it. Each line 
represents a different data set. The line types must be h, i.e. ‘histogram’ 
like (or ‘high-density’) vertical lines. The problem is that the vertical lines 
comprising a plot line of type=h are drawn from the y=0 line to the (x, y) 
locations. What I need is vertical lines drawn from the line y=value that I 
specify to the (x, y) locations. Is there a way for me to achieve that?

Thank you very much for your responsiveness and attention.

Regards,
Martin

__
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] cannot reproduce matlab wavelet results with R

2009-03-27 Thread Martin Ivanov
Dear R users,
I want to get the D1 details reconstructed
to the level of my time series. My original time series is NH$annual[,]
and it has 118 elements. This is the code I use and the results:
library(wavelets)
NHj - extend.series(X=NH$annual[,], method=reflection,
length=powerof2, j=7);
detach(package:wavelets)
attributes(mra(X=NHj, filter=d4, n.levels=7, boundary=reflection,
fast=TRUE, method=dwt))$D[[1]][1:20]
[1] -0.0363166651  0.0793856487  0.0229855716 -0.0863862067  0.0586129763
 [6] -0.0552697096  0.0049741291  0.0327406169  0.0006990289 -0.0150729128
[11] -0.0203610433  0.0424490289 -0.0103379856 -0.0072504717 -0.0310480084
[16]  0.0543716287  0.0491613932 -0.1187032803  0.0317373320  0.0132924682
detach(package:wavelets)
library(waveslim)
mra(x=NHj, wf = d4, J = 7, method = dwt, boundary =
reflection)$D1[1:20]
 [1] -0.0363166651  0.0793856487  0.0229855716 -0.0863862067  0.0586129763
 [6] -0.0552697096  0.0049741291  0.0327406169  0.0006990289 -0.0150729128
[11] -0.0203610433  0.0424490289 -0.0103379856 -0.0072504717 -0.0310480084
[16]  0.0543716287  0.0491613932 -0.1187032803  0.0317373320  0.0132924682
detach(package:waveslim)
library(wmtsa)
wavMRDSum(x=NHj, wavelet=d4,levels=1, xform=dwt, reflect=FALSE,
keep.smooth=FALSE, keep.details=TRUE)[1:20]
  t=0   t=1   t=2   t=3   t=4
-0.1449234169  0.0166815113  0.0229855716 -0.0863862067  0.0586129763
  t=5   t=6   t=7   t=8   t=9
-0.0552697096  0.0049741291  0.0327406169  0.0006990289 -0.0150729128
 t=10  t=11  t=12  t=13  t=14
-0.0203610433  0.0424490289 -0.0103379856 -0.0072504717 -0.0310480084
 t=15  t=16  t=17  t=18  t=19
 0.0543716287  0.0491613932 -0.1187032803  0.0317373320  0.0132924682

detach(package:wmtsa)
library(wavethresh)
NHwd.obj - wd(data=NHj, filter.number=4, family=DaubExPhase,
type=wavelet, bc=symmetric, verbose=TRUE);
NHwd.objA0 - putC(wd=NHwd.obj, level=6, v=rep(0,2^6), boundary=FALSE,
index=FALSE);
D1 - accessC(wd=wr(wd=NHwd.objA0, start.level = 6, return.object = TRUE,
verbose = TRUE),level=7,boundary=FALSE);
D1[1:20]
 [1] -0.25283845  0.06657357  0.03389600 -0.04797488  0.05665413 -0.09317851
 [7]  0.06466827  0.06839502 -0.07792329 -0.06458924  0.07678030  0.04101479
[13] -0.08070069  0.06491276 -0.02459910 -0.05140745  0.07088627 -0.03537575
[19]  0.01366095 -0.01599816

As you can see, with wavethresh the results are quite different. Have I
messed something up? Is this the correct way of getting the D1 details? I
am a former matlab user, and the results I get with it are only
reproducible in R with the other 3 packages and the d2 or haar
wavelets. With any other wavelet, e.g. d4 I get different results.I
would be very thankful to you if you give me some clue.

I really apologize for taking some of your precious time. I wish you fruitful 
work.

Regards,
Martin
27.03.2009

__
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] wavethresh start.level problem

2009-03-25 Thread Martin Ivanov
Dear R users, 
 
 I am running R-2.8.1 with wavethresh-2.2-11 
 I have a problem with the function wr, used for reconstructing wd objects. The 
problem is that I cannot set start.level to any integer value greater than 1. 
Whenever I set it to any value greater than 1, I get: 
 Building level: 1 reflect: access error (-1,3) 
 Error in mywr(wd = sw.db2A0, start.level = 5, verbose = TRUE, return.object = 
TRUE) : 
 convolveC: error exit (6) 
 
 My series is 2^7 long, so I should be able to start the reconstruction from 
higher levels. 
 Does any one know how to get round this problem? 
 
 I need to start the reconstruction from higher levels, because I need the 
approximations and details series reconstructed for each level at the 
resolution of the highest level. For this reason I need to set the respective 
approximations coefficients to 0. If I start reconstruction from the lowest 
level, during reconstruction the coefficients are recalculated and they are no 
longer 0. 
 
 I would be grateful also if someone suggests some alternative way of 
calculating the reconstructions I need, for example using different packages. I 
selected wavethresh to work with because it is last updated and seems well 
supported. 
 
 Regards, 
 Martin Ivanov

__
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] arima additive vs multiplicative seasonality

2009-03-04 Thread Martin Ivanov
Hello!
I would like to ask whether the seasonality implemented in arima() is additive 
or multiplicative? I searched a lot, but I could not find an answer to that 
question, although it has been asked other times too.

Thank you very much for your attention.

Regards, 
Martin

__
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] arima additive seasonality

2009-03-04 Thread Martin Ivanov
Hello!
I asked in this forum about what kind of seasonality the function arima() from 
stats implements. Now that I have been answered that it implements the 
Box-Jenkins multiplicative seasonality, I would like to ask whether there is in 
R possibility to model ARIMA with additive seasonality. I mean whether there is 
a function or package that implements additive seasonality. In case there is no 
such function, I would be thankful if someone suggests some code for the 
purpose. 

Thank you very much for your attention.

Regards,
Martin

__
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] univariate impulse responses

2007-10-16 Thread Martin Ivanov
Dear R users,

I need to calculate the univariate impulse response function for a series of 
data. Unfortunately the vars package does not support univariate analysis. If I 
try to evaluate a single series like this:
VAR(y=xres,p=1,type=none,ic=AIC)

the result is
Error in VAR(y = xres, p = 1, type = none, ic = AIC) : 
  The matrix 'y' should contain at least two variables. For univariate analysis 
consider ar() and arima() in package stats.

However, the irf function does not work with objects output by ar or arima. Any 
ideas what I could do?

Regards,
Martin

-
Крайна цел - Да оцелееш! www.survivor.btv.bg

__
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 question on impulse responses

2007-10-13 Thread Martin Ivanov

Dear R users,

I am using the vars package to calculate the impulse response functions and the 
forecast error variance decomposition of a VAR model. Unfortunately I do not 
know whether these functions assume unit or one standard deviation shocks. I 
tried to look into the code of these functions, but in vain: neither irf, nor 
vars::irf, nor vars:::irf output the code of the functions. Does someone know 
whether irf and fevd assume one standard deviation or a unit shock? How can I 
see the code of these functions?

Regards,
Martin Ivanov

-
Крайна цел - Да оцелееш! www.survivor.btv.bg

__
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] vars shocks assumption

2007-10-13 Thread Martin Ivanov

Dear R users,

I am using the vars package to calculate the impulse response functions and the 
forecast error variance decomposition of a VAR model. Unfortunately I do not 
know whether these functions assume unit or one standard deviation shocks. I 
tried to look into the code of these functions, but in vain: neither irf, nor 
vars::irf, nor vars:::irf output the code of the functions. Does someone know 
whether irf and fevd assume one standard deviation or a unit shock? How can I 
see the code of these functions?

Regards,
Martin Ivanov

-
Крайна цел - Да оцелееш! www.survivor.btv.bg

__
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] impulse responses: standard deviation or unit shocks?

2007-10-13 Thread Martin Ivanov
Dear R users,

I am using the vars package to calculate the impulse response functions and the 
forecast error variance decomposition of a VAR model. Unfortunately I do not 
know whether these functions assume unit or one standard deviation shocks. I 
tried to look into the code of these functions, but in vain: neither irf, nor 
vars::irf, nor vars:::irf output the code of the functions. Does someone know 
whether irf and fevd assume one standard deviation or a unit shock? How can I 
see the code of these functions?

-
Крайна цел - Да оцелееш! www.survivor.btv.bg

__
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] irfs from a no intercept VAR

2007-10-12 Thread Martin Ivanov
Dear R users,

I need perform structural analysis on a no intercept VAR model. Unfortunately 
the functions irf.VAR and dfev that come with the MSBVAR package only work with 
objects output by the reduced.form.var function, which seems to only evaluate 
VAR models with intercept. Is there a way to suppress the estimation of 
intercept term in reduced.form.var? Do I need to modify the code, and if I do, 
how? Is there a way to apply irf and dfev to objects of type systemfit?

Regards,
Martin Ivanov

-
Крайна цел - Да оцелееш! www.survivor.btv.bg

__
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] rearrange data columns

2007-10-11 Thread Martin Ivanov
Dear R users, 
 I need to to the the following. Let a= 1 2 3 
 4 5 6 
 and b= -1 -2 -3  be (2x3) matrices.
-4 -5 -6 
 I need to combine the two matrices into a new (2x6) matrix like this: 
 
 ab = ( 1 -1 2 -2 3 -3 ) 
4 -4 5 -5 6 -6 
 
 How can this be done in R? 
 


-
Крайна цел - Да оцелееш! www.survivor.btv.bg

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