Re: [R] [Rd] I do not want that R CMD build removes temp directory

2022-12-19 Thread Witold E Wolski
Dear Uwe,

Unfortunately there isn't much of an output. This is all what I have:

$ R CMD INSTALL --log prolfqua
Warning: unknown option '--log'
* installing to library 'C:/Users/witoldwolski/AppData/Local/R/win-library/4.2'
* installing *source* package 'prolfqua' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
ERROR: lazy loading failed for package 'prolfqua'
* removing 'C:/Users/witoldwolski/AppData/Local/R/win-library/4.2/prolfqua'

Also with --no-test-load option the install is failing :

$ R CMD INSTALL --clean --no-test-load prolfqua

* installing to library 'C:/Users/witoldwolski/AppData/Local/R/win-library/4.2'
* installing *source* package 'prolfqua' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
ERROR: lazy loading failed for package 'prolfqua'
* removing 'C:/Users/witoldwolski/AppData/Local/R/win-library/4.2/prolfqua'

And including "--no-clean-on-error" also does not help because the
installation directory is empty.


Tested the install, on macos M1, linux ARM64, linux x86, Windows 64,
and it works everywhere except
Parallels Windows 64 on ARM M1.

R version 4.2.2 (2022-10-31 ucrt) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

best regards
Witek



On Fri, 16 Dec 2022 at 11:24, Uwe Ligges
 wrote:
>
>
>
> On 15.12.2022 21:47, Witold E Wolski wrote:
> > Thank you Simon,
> >
> > It seems not to be related to the R package but rather to the OS,
> > (just got the same error when installing the shiny R package from
> > CRAN).
> > I am on an M1 mac running Windows ARM in Parallels. Installed a
> > x86_64-w64 R version.
> >
> >
> >
> > "** byte-compile and prepare package for lazy loading
> > ERROR: lazy loading failed for package 'shiny'
> > * removing 'C:/Users/witoldwolski/AppData/Local/R/win-library/4.2/shiny'
> > Warning in install.packages :"
>
> Can we please have the full output?
>
> Best,
> Uwe Ligges
>
>
>
> > On Thu, 15 Dec 2022 at 19:09, Simon Urbanek  
> > wrote:
> >>
> >> Yes:
> >>
> >> $ R CMD INSTALL --help | grep error
> >>--no-clean-on-error   do not remove installed package on error
> >>
> >> But probably more commonly used way is to install the package from its 
> >> unpacked directory as that avoids the use of temporary directories in the 
> >> first place.
> >>
> >> In you case you can also use --no-test-load and the non-functional package 
> >> will still be installed so you can inspect it.
> >>
> >> Cheers,
> >> Simon
> >>
> >> PS: please don't cross-post
> >>
> >>
> >>> On Dec 16, 2022, at 7:01 AM, Witold E Wolski  wrote:
> >>>
> >>> I am getting a package build error, and can not figure out the problem.
> >>> The error is
> >>> "
> >>> ERROR: lazy loading failed for package 'prolfqua'
> >>> * removing 'C:/Users/
> >>> "
> >>> However since R CMD build removes the temp directory and does not give
> >>> any other errors how can I find out what the build problem is?
> >>>
> >>> Is there a way to disable the temp directory removal?
> >>>
> >>> Best Regards
> >>> Witek
> >>> --
> >>> Witold Eryk Wolski
> >>>
> >>> __
> >>> r-de...@r-project.org mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-devel
> >>>
> >>
> >
> >



--
Witold Eryk Wolski

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


Re: [R] [Rd] I do not want that R CMD build removes temp directory

2022-12-15 Thread Witold E Wolski
Thank you Simon,

It seems not to be related to the R package but rather to the OS,
(just got the same error when installing the shiny R package from
CRAN).
I am on an M1 mac running Windows ARM in Parallels. Installed a
x86_64-w64 R version.



"** byte-compile and prepare package for lazy loading
ERROR: lazy loading failed for package 'shiny'
* removing 'C:/Users/witoldwolski/AppData/Local/R/win-library/4.2/shiny'
Warning in install.packages :"

On Thu, 15 Dec 2022 at 19:09, Simon Urbanek  wrote:
>
> Yes:
>
> $ R CMD INSTALL --help | grep error
>   --no-clean-on-error   do not remove installed package on error
>
> But probably more commonly used way is to install the package from its 
> unpacked directory as that avoids the use of temporary directories in the 
> first place.
>
> In you case you can also use --no-test-load and the non-functional package 
> will still be installed so you can inspect it.
>
> Cheers,
> Simon
>
> PS: please don't cross-post
>
>
> > On Dec 16, 2022, at 7:01 AM, Witold E Wolski  wrote:
> >
> > I am getting a package build error, and can not figure out the problem.
> > The error is
> > "
> > ERROR: lazy loading failed for package 'prolfqua'
> > * removing 'C:/Users/
> > "
> > However since R CMD build removes the temp directory and does not give
> > any other errors how can I find out what the build problem is?
> >
> > Is there a way to disable the temp directory removal?
> >
> > Best Regards
> > Witek
> > --
> > Witold Eryk Wolski
> >
> > __
> > r-de...@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>


-- 
Witold Eryk Wolski

__
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] I do not want that R CMD build removes temp directory

2022-12-15 Thread Witold E Wolski
I am getting a package build error, and can not figure out the problem.
The error is
"
ERROR: lazy loading failed for package 'prolfqua'
* removing 'C:/Users/
"
However since R CMD build removes the temp directory and does not give
any other errors how can I find out what the build problem is?

Is there a way to disable the temp directory removal?

Best Regards
Witek
-- 
Witold Eryk Wolski

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


Re: [R] Package installation for 4.1 on windows.

2021-06-10 Thread Witold E Wolski
Dear Duncan,

Thank you. Indeed I did had the R_LIBS_USER env. variable defined.

Best regards
Witold

On Mon, 7 Jun 2021 at 17:48, Duncan Murdoch  wrote:
>
> On 07/06/2021 10:37 a.m., Witold E Wolski wrote:
> > Hello,
> >
> > I just installed R 4.1 and now trying to update install some packages.
> >
> > R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
> > Copyright (C) 2021 The R Foundation for Statistical Computing
> >
> > But when installing packages I read:
> >
> > Installing packages into ‘C:/Users/wolski/Documents/R/win-library/4.0’
> >
> > Should not be a win-library/4.1. package directory be used by default?
> >
>
> I suspect something in your local setup specifies that directory.  The
> usual place to install is the directory where R was installed; it only
> switches to the user home directory if that fails, or the user requests it.
>
> Duncan Murdoch



-- 
Witold Eryk Wolski

__
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] Package installation for 4.1 on windows.

2021-06-07 Thread Witold E Wolski
Hello,

I just installed R 4.1 and now trying to update install some packages.

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing

But when installing packages I read:

Installing packages into ‘C:/Users/wolski/Documents/R/win-library/4.0’

Should not be a win-library/4.1. package directory be used by default?

Best regards
Witold

-- 
Witold Eryk Wolski

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


Re: [R] brms does not work with R4.0.2

2020-07-13 Thread Witold E Wolski
Hello,

Got the following info from the brms package Maintainer.

"This is a caused by a problem in the current rstan CRAN version on
Windows and is not related to brms. You can find various threads that
deal with that topic on https://discourse.mc-stan.org/. For now, it
may be easiest to revert to rstan 2.19.3."

Thanks
Witek



On Mon, 13 Jul 2020 at 15:41, Witold E Wolski  wrote:
>
> Hello,
>
> I upgraded today to R4.0.2 from 3.6.3 on my Windows machine (actually
> 2 of them - first desktop and then laptop just to verify the problem)
> and on both of them I am getting the following error when running the
> brms::brm function example code.
>
> ```
> > bprior1 <- prior(student_t(5,0,10), class = b) +
> + prior(cauchy(0,2), class = sd)
> > fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),
> + data = epilepsy, family = poisson(), prior = bprior1)
> Compiling the C++ model
> >
> > fit1
> Error: object 'fit1' not found
> ```
>
> I tried to get some more information by setting `silent = FALSE` but
> nothing is being printed.
> All I see is:
>
> ```
> > brm(count ~ zAge + zBase * Trt + (1|patient),
> + data = epilepsy, family = poisson(), prior = bprior1, silent=FALSE)
> Compiling the C++ model
> >
> ```
>
> R tools is installed and I did test that they work properly.
> Also:
>
> ```
> system.file(package = "StanHeaders")
> [1] "C:/Users/wewol/OneDrive/Documents/R/win-library/4.0/StanHeaders"
> ```
>
> Help highly appreciated.
>
> Witek
> --
> Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
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] brms does not work with R4.0.2

2020-07-13 Thread Witold E Wolski
Hello,

I upgraded today to R4.0.2 from 3.6.3 on my Windows machine (actually
2 of them - first desktop and then laptop just to verify the problem)
and on both of them I am getting the following error when running the
brms::brm function example code.

```
> bprior1 <- prior(student_t(5,0,10), class = b) +
+ prior(cauchy(0,2), class = sd)
> fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),
+ data = epilepsy, family = poisson(), prior = bprior1)
Compiling the C++ model
>
> fit1
Error: object 'fit1' not found
```

I tried to get some more information by setting `silent = FALSE` but
nothing is being printed.
All I see is:

```
> brm(count ~ zAge + zBase * Trt + (1|patient),
+ data = epilepsy, family = poisson(), prior = bprior1, silent=FALSE)
Compiling the C++ model
>
```

R tools is installed and I did test that they work properly.
Also:

```
system.file(package = "StanHeaders")
[1] "C:/Users/wewol/OneDrive/Documents/R/win-library/4.0/StanHeaders"
```

Help highly appreciated.

Witek
--
Witold Eryk Wolski

__
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] smoothScatter() and the KernSmooth package

2020-06-17 Thread Witold E Wolski
Hello,

I am getting the following error when running a package check
```
  Error in loadNamespace(name) : there is no package called 'KernSmooth'
  Calls:  ... loadNamespace -> withRestarts ->
withOneRestart -> doWithOneRestart
  Execution halted
```

The error happens in a function which calls graphics::smoothScatter

I found this e-mail on the r-devel list where this problem is also reported.
https://stat.ethz.ch/pipermail/r-devel/2015-February/070671.html

So I could add KernSmooth to Suggest in the DESCRIPTION but I have a
few questions:
(and I am citing from the e-mail above to which I could not find a reply):

"I have a few questions: isn't it unusual the way smoothScatter calls

grDevices:::.smoothScatterCalcDensity() and KernSmooth::bkde2D(),
i.e., without requiring the packages?
Shouldn't "graphics" suggest "KernSmooth"?
"

best regards
Witek




-- 
Witold Eryk Wolski

__
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] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Witold E Wolski
Hello,

I would like to decompose a string i.e.

"a - b"
or "a +b"

into an array or list
["a","-","b"]

Since R knows how to parse expressions these type of expressions I
would like to reuse some existing functions and not to use gsub or
strsplit etc.

Thank you
Witek

-- 
Witold Eryk Wolski

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


Re: [R] stats::power.t.test error

2019-10-15 Thread Witold E Wolski
Dear Peter,

Yes, It is a technical issue and a matter of diddling around. And I
agree with your comment regarding the 2 observations.
I have several thousands variance estimates for which I need to
compute the sample sizes automatically. Using try statements is
typically the last thing I would like to resort too.
Is there an alternative implementation of power.t.test on CRAN which
could the diddling for me and return plausible sample sizes i.e.
integers.

best regards
Witek

On Fri, 4 Oct 2019 at 16:28, peter dalgaard  wrote:
>
> This is mainly a technical issue with uniroot trying to go outside of its 
> interval: (2, 1e7)
>
> It is fairly easy to find an approximate solution by diddling a little by 
> hand:
>
> > power.t.test(delta = 0.5849625, sd=0.01, n=1.04, sig.level=0.05)$power
> [1] 0.8023375
>
> Notice, however, that 1.04 observations in each group makes no sense at all. 
> In order to actually do a t-test you need at least 2 observations per group 
> (since we assume equal group sizes) or you have no variance estimate. Already 
> at sd=0.1, you are crossing the n=2 border, so for any smaller sd, you will 
> just get higher power with n=2. (Also, anything with single-digit degrees of 
> freedom for variance is probably expecting rather much regarding to Gaussian 
> distribution of your data.)
>
> -pd
>
> > On 4 Oct 2019, at 14:30 , Witold E Wolski  wrote:
> >
> > Hi,
> >
> > power.t.test works for some range of input parameters but fails otherwise.
> >
> >> power.t.test(delta = 0.5849625, sd=0.1, power=0.8, sig.level=0.05)$n
> > [1] 1.971668
> >> power.t.test(delta = 0.5849625, sd=0.05, power=0.8, sig.level=0.05)$n
> > [1] 1.620328
> >> power.t.test(delta = 0.5849625, sd=0.01, power=0.8, sig.level=0.05)$n
> > Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07), tol = tol,  
> > :
> >  did not succeed extending the interval endpoints for f(lower) * f(upper) 
> > <= 0
> > In addition: Warning message:
> > In qt(sig.level/tside, nu, lower.tail = FALSE) : NaNs produced
> >
> > I guessing that sd is very small compared with delta, hence the
> > problem. But what are allowed values (ratios) of delta and sd?
> >
> > Best
> > Witek
> >
> >
> >
> >
> >
> >
> > --
> > Witold Eryk Wolski
> >
> > __
> > 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.
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>
>
>
>
>
>
>


-- 
Witold Eryk Wolski

__
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] stats::power.t.test error

2019-10-04 Thread Witold E Wolski
Hi,

power.t.test works for some range of input parameters but fails otherwise.

> power.t.test(delta = 0.5849625, sd=0.1, power=0.8, sig.level=0.05)$n
[1] 1.971668
> power.t.test(delta = 0.5849625, sd=0.05, power=0.8, sig.level=0.05)$n
[1] 1.620328
> power.t.test(delta = 0.5849625, sd=0.01, power=0.8, sig.level=0.05)$n
Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07), tol = tol,  :
  did not succeed extending the interval endpoints for f(lower) * f(upper) <= 0
In addition: Warning message:
In qt(sig.level/tside, nu, lower.tail = FALSE) : NaNs produced

I guessing that sd is very small compared with delta, hence the
problem. But what are allowed values (ratios) of delta and sd?

Best
Witek






-- 
Witold Eryk Wolski

__
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] linear model contrast in R

2019-05-13 Thread Witold E Wolski
I am looking for a function to compute contrasts with a interface
similar to that of

lmerTest::contest
multcomp::glht

i.e. taking the model and a contrast vector or matrix as an argument,
but for linear models, and without the multiple testing adjusted made
by multcomp::glht.

Thank you


-- 
Witold Eryk Wolski

__
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] isSingular for lm?

2019-04-05 Thread Witold E Wolski
lme4 has a function isSingular to check if the fitted model is Singular,

Although lm has the parameter singular.ok = TRUE by defualt, I could
not find a function to check if the fitted model is singular.

What would be the correct way to implement such a function for and lm object?
Check if df.residuals == 0

Thanks
Witek





-- 
Witold Eryk Wolski

__
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] randomForest out of bag prediction

2019-01-12 Thread Witold E Wolski
Hello,

I am just not sure what the predict.RandomForest function is doing...
I confused.

I would expect the predictions for these 2 function calls to predict the same:
```{r}
diachp.rf <- randomForest(quality~.,data=data,ntree=50, importance=TRUE)

ypred_oob <- predict(diachp.rf)
dataX <- data %>% select(-quality) # remove response.
ypred <- predict( diachp.rf, dataX )

ypred_oob == ypred
```
These are both out of bag predictions but ypred and ypred_oob are
actually they are very different.

> table(ypred_oob , data$quality)

ypred_oob01
0 1324  346
1  493 2837
> table(ypred , data$quality)

ypred01
0 18170
10 3183

What I find even more disturbing is that 100% accuracy for ypred.
Would you agree that this is rather unexpected?

regards
Witek
-- 
Witold Eryk Wolski

__
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] Visualizing contrasts for lmer models

2018-12-13 Thread Witold E Wolski
Hello,

Is there an R-package which implements visualizations of estimated
coefficients and the data for lmer models similar to those shown here:

http://genomicsclass.github.io/book/pages/interactions_and_contrasts.html
in sections:

Examining the estimated coefficients
(ideally with ggplot)

???

I find these visualizations (especially those for contrasts) very
helpful but despite R -package searches I failed to find a generic
implementation.

best regards
Witek

Witold Eryk Wolski

__
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] See section 'Good practice' in '?data'.

2016-12-10 Thread Witold E Wolski
To which document
"See section 'Good practice' in '?data'."

refers too?


Found the following calls to data() loading into the global environment:
File 'bibliospec/R/annotateClass.R':
  data("AminoAcids")
See section 'Good practice' in '?data'.

Thanks


-- 
Witold Eryk Wolski

__
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] Error: XYZ is not an exported object

2016-12-10 Thread Witold E Wolski
I am wrting a package and would like to be able to export it to access it with:

packagename::dataset

This is how my roxygen doc for the data object looks like:
#' Data frame with amino acid masses
#'
#' @name AminoAcids
#' @docType data
#' @keywords data
#' @export
NULL

It does end up in the namespace file with:
export(AminoAcids)

the data is in the data/ folder of the package.
and I can load it with data(AminoAcid)

Still R CMD build gives me the error:
Error : 'AminoAcids' is not an exported object from 'namespace:bibliospec'

because I am trying to access it with bibliospec::AminoAcids

Help highly appreciated.

Thank you

-- 
Witold Eryk Wolski

__
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] create n suffixes of length 1:n from string of length n

2016-10-19 Thread Witold E Wolski
Is there a build in function, which creates n suffixes of length 1:n
from string of length n?
e.g given abcd

produces
"a"
"ab"
"abc"


FAST.

equally nice to have would be:

e.g.
given c("a", "b", "c")
produces
"a"
"a","b"
"a","b","c"

Thank you
Witold


-- 
Witold Eryk Wolski

__
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] rstudio mailing list

2016-10-19 Thread Witold E Wolski
Is there a mailing list for Rstudio related questions? I searched the
web but did not find one.

Thank you

-- 
Witold Eryk Wolski

__
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] documenting R reference class methods with roxygen2

2016-07-20 Thread Witold E Wolski
I would like to document function arguments in R reference classes and
I do not know how.

I know that methods description can be provided by adding
a string below the function declaration. But how to document the
function arguments in similar fashion like the arguments of R
functions (which can be documented with @param).

Thank you.

PS. Sorry if for some this question is off topic but I did not found a
mailing list dedicated to roxygen2.



-- 
Witold Eryk Wolski

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


Re: [R] [FORGED] Splitting data.frame into a list of small data.frames given indices

2016-07-02 Thread Witold E Wolski
Hi Bert,

My reply is inline:

On 1 July 2016 at 17:02, Bert Gunter <bgunter.4...@gmail.com> wrote:
> Inline.
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Fri, Jul 1, 2016 at 7:40 AM, Witold E Wolski <wewol...@gmail.com> wrote:
>> Hi William,
>>
>> I tested plyrs dlply function, and it seems to have  have an O(N*
>> log(R)) complexity (tested for R=N) so I do not know if N is the
>> number of rows or nr of categories.
>>
>> For the data.frame example with 2e5 rows and 2e5 categories it is
>> approx. 10 times faster than split. Still, it is 10 seconds on an
>> i7-5930K 3.5GHz Intel.
>>
>> It would be nice if the documentation would contain runtime
>> complexity information and the documentation of base package function
>> would point to function which should be used instead.
>
> It would, indeed -- but these things are very dependent on exact data
> context, the hardware in use, the OS, etc.  Moreover, how could base
> documentation possibly keep track of what all other packages are
> doing?! -- that seems unreasonable on the face of it.

Old methods need to stay for backward compatibility but why not
include new packages, which are a clear improvement over the old ones,
into the default packages and reference them?

 I know that
> from time to time R docs do mention base algorithmic complexity (e.g.
> ?sort and the data.table package, I believe), but generally it is
> preferable to omit such details, imho: access to a function should be
> through its relatively fixed API, while the underlying machinery may
> be subject to considerable change.

Just take a look how the C++ stl or the python documents functions for
working with containers. They do provide information about complexity
of operations, or algorithms. Such information is needed to make
reasonable decisions, including not to use a function or a container
type.

If there is a new implementation that changes complexity this
information needs to be updated.


Obviously, there are circumstances
> where something still could (and perhaps should) be said about
> efficiency -- and R docs often do say it -- but I think the level of
> detail you request is unrealistic and might often even mislead.
>
> Obviously, just my opinion, so contrary views welcome.
>
> Cheers,
> Bert
>
>
>>
>> Thanks
>>
>>
>>
>>
>> On 29 June 2016 at 16:13, William Dunlap <wdun...@tibco.com> wrote:
>>> I won't go into why splitting data.frames (or factors) uses time
>>> proportional to the number of input rows times the number of
>>> levels in the splitting factor, but you will get much better mileage
>>> if you call split individually on each 'atomic' (numeric, character, ...)
>>> variable and use mapply on the resulting lists.
>>>
>>> The plyr and dplyr packages were developed to deal with this
>>> sort of problem.  Check them out.
>>>
>>>
>>> Bill Dunlap
>>> TIBCO Software
>>> wdunlap tibco.com
>>>
>>> On Wed, Jun 29, 2016 at 6:21 AM, Witold E Wolski <wewol...@gmail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Here is an complete example which shows the the complexity of split or
>>>> by is O(n^2)
>>>>
>>>> nrows <- c(1e3,5e3, 1e4 ,5e4, 1e5 ,2e5)
>>>> res<-list()
>>>>
>>>> for(i in nrows){
>>>>   dum <- data.frame(x = runif(i,1,1000), y=runif(i,1,1000))
>>>>   res[[length(res)+1]]<-(system.time(x<- split(dum, 1:nrow(dum
>>>> }
>>>> res <- do.call("rbind",res)
>>>> plot(nrows^2, res[,"elapsed"])
>>>>
>>>> And I can't see a reason why this has to be so slow.
>>>>
>>>>
>>>> cheers
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 29 June 2016 at 12:00, Rolf Turner <r.tur...@auckland.ac.nz> wrote:
>>>> > On 29/06/16 21:16, Witold E Wolski wrote:
>>>> >>
>>>> >> It's the inverse problem to merging a list of data.frames into a large
>>>> >> data.frame just discussed in the "performance of do.call("rbind")"
>>>> >> thread
>>>> >>
>>>> >> I would like to split a data.frame into a list of data.frames
>>>&

Re: [R] [FORGED] Splitting data.frame into a list of small data.frames given indices

2016-07-01 Thread Witold E Wolski
Hi William,

I tested plyrs dlply function, and it seems to have  have an O(N*
log(R)) complexity (tested for R=N) so I do not know if N is the
number of rows or nr of categories.

For the data.frame example with 2e5 rows and 2e5 categories it is
approx. 10 times faster than split. Still, it is 10 seconds on an
i7-5930K 3.5GHz Intel.

It would be nice if the documentation would contain runtime
complexity information and the documentation of base package function
would point to function which should be used instead.

Thanks




On 29 June 2016 at 16:13, William Dunlap <wdun...@tibco.com> wrote:
> I won't go into why splitting data.frames (or factors) uses time
> proportional to the number of input rows times the number of
> levels in the splitting factor, but you will get much better mileage
> if you call split individually on each 'atomic' (numeric, character, ...)
> variable and use mapply on the resulting lists.
>
> The plyr and dplyr packages were developed to deal with this
> sort of problem.  Check them out.
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Wed, Jun 29, 2016 at 6:21 AM, Witold E Wolski <wewol...@gmail.com> wrote:
>>
>> Hi,
>>
>> Here is an complete example which shows the the complexity of split or
>> by is O(n^2)
>>
>> nrows <- c(1e3,5e3, 1e4 ,5e4, 1e5 ,2e5)
>> res<-list()
>>
>> for(i in nrows){
>>   dum <- data.frame(x = runif(i,1,1000), y=runif(i,1,1000))
>>   res[[length(res)+1]]<-(system.time(x<- split(dum, 1:nrow(dum
>> }
>> res <- do.call("rbind",res)
>> plot(nrows^2, res[,"elapsed"])
>>
>> And I can't see a reason why this has to be so slow.
>>
>>
>> cheers
>>
>>
>>
>>
>>
>>
>>
>> On 29 June 2016 at 12:00, Rolf Turner <r.tur...@auckland.ac.nz> wrote:
>> > On 29/06/16 21:16, Witold E Wolski wrote:
>> >>
>> >> It's the inverse problem to merging a list of data.frames into a large
>> >> data.frame just discussed in the "performance of do.call("rbind")"
>> >> thread
>> >>
>> >> I would like to split a data.frame into a list of data.frames
>> >> according to first column.
>> >> This SEEMS to be easily possible with the function base::by. However,
>> >> as soon as the data.frame has a few million rows this function CAN NOT
>> >> BE USED (except you have A PLENTY OF TIME).
>> >>
>> >> for 'by' runtime ~ nrow^2, or formally O(n^2)  (see benchmark below).
>> >>
>> >> So basically I am looking for a similar function with better
>> >> complexity.
>> >>
>> >>
>> >>  > nrows <- c(1e5,1e6,2e6,3e6,5e6)
>> >>>
>> >>> timing <- list()
>> >>> for(i in nrows){
>> >>
>> >> + dum <- peaks[1:i,]
>> >> + timing[[length(timing)+1]] <- system.time(x<- by(dum[,2:3],
>> >> INDICES=list(dum[,1]), FUN=function(x){x}, simplify = FALSE))
>> >> + }
>> >>>
>> >>> names(timing)<- nrows
>> >>> timing
>> >>
>> >> $`1e+05`
>> >>user  system elapsed
>> >>0.050.000.05
>> >>
>> >> $`1e+06`
>> >>user  system elapsed
>> >>1.482.984.46
>> >>
>> >> $`2e+06`
>> >>user  system elapsed
>> >>7.25   11.39   18.65
>> >>
>> >> $`3e+06`
>> >>user  system elapsed
>> >>   16.15   25.81   41.99
>> >>
>> >> $`5e+06`
>> >>user  system elapsed
>> >>   43.22   74.72  118.09
>> >
>> >
>> > I'm not sure that I follow what you're doing, and your example is not
>> > reproducible, since we have no idea what "peaks" is, but on a toy
>> > example
>> > with 5e6 rows in the data frame I got a timing result of
>> >
>> >user  system elapsed
>> >   0.379 0.025 0.406
>> >
>> > when I applied split().  Is this adequately fast? Seems to me that if
>> > you
>> > want to split something, split() would be a good place to start.
>> >
>> > cheers,
>> >
>> > Rolf Turner
>> >
>> > --
>> > Technical Editor ANZJS
>> > Department of Statistics
>> > University of Auckland
>> > Phone: +64-9-373-7599 ext. 88276
>>
>>
>>
>> --
>> Witold Eryk Wolski
>>
>> __
>> 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.
>
>



-- 
Witold Eryk Wolski

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


Re: [R] [FORGED] Splitting data.frame into a list of small data.frames given indices

2016-06-29 Thread Witold E Wolski
Hi,

Here is an complete example which shows the the complexity of split or
by is O(n^2)

nrows <- c(1e3,5e3, 1e4 ,5e4, 1e5 ,2e5)
res<-list()

for(i in nrows){
  dum <- data.frame(x = runif(i,1,1000), y=runif(i,1,1000))
  res[[length(res)+1]]<-(system.time(x<- split(dum, 1:nrow(dum
}
res <- do.call("rbind",res)
plot(nrows^2, res[,"elapsed"])

And I can't see a reason why this has to be so slow.


cheers







On 29 June 2016 at 12:00, Rolf Turner <r.tur...@auckland.ac.nz> wrote:
> On 29/06/16 21:16, Witold E Wolski wrote:
>>
>> It's the inverse problem to merging a list of data.frames into a large
>> data.frame just discussed in the "performance of do.call("rbind")"
>> thread
>>
>> I would like to split a data.frame into a list of data.frames
>> according to first column.
>> This SEEMS to be easily possible with the function base::by. However,
>> as soon as the data.frame has a few million rows this function CAN NOT
>> BE USED (except you have A PLENTY OF TIME).
>>
>> for 'by' runtime ~ nrow^2, or formally O(n^2)  (see benchmark below).
>>
>> So basically I am looking for a similar function with better complexity.
>>
>>
>>  > nrows <- c(1e5,1e6,2e6,3e6,5e6)
>>>
>>> timing <- list()
>>> for(i in nrows){
>>
>> + dum <- peaks[1:i,]
>> + timing[[length(timing)+1]] <- system.time(x<- by(dum[,2:3],
>> INDICES=list(dum[,1]), FUN=function(x){x}, simplify = FALSE))
>> + }
>>>
>>> names(timing)<- nrows
>>> timing
>>
>> $`1e+05`
>>user  system elapsed
>>0.050.000.05
>>
>> $`1e+06`
>>user  system elapsed
>>1.482.984.46
>>
>> $`2e+06`
>>user  system elapsed
>>7.25   11.39   18.65
>>
>> $`3e+06`
>>user  system elapsed
>>   16.15   25.81   41.99
>>
>> $`5e+06`
>>user  system elapsed
>>   43.22   74.72  118.09
>
>
> I'm not sure that I follow what you're doing, and your example is not
> reproducible, since we have no idea what "peaks" is, but on a toy example
> with 5e6 rows in the data frame I got a timing result of
>
>user  system elapsed
>   0.379 0.025 0.406
>
> when I applied split().  Is this adequately fast? Seems to me that if you
> want to split something, split() would be a good place to start.
>
> cheers,
>
> Rolf Turner
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276



-- 
Witold Eryk Wolski

__
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] Splitting data.frame into a list of small data.frames given indices

2016-06-29 Thread Witold E Wolski
It's the inverse problem to merging a list of data.frames into a large
data.frame just discussed in the "performance of do.call("rbind")"
thread

I would like to split a data.frame into a list of data.frames
according to first column.
This SEEMS to be easily possible with the function base::by. However,
as soon as the data.frame has a few million rows this function CAN NOT
BE USED (except you have A PLENTY OF TIME).

for 'by' runtime ~ nrow^2, or formally O(n^2)  (see benchmark below).

So basically I am looking for a similar function with better complexity.


 > nrows <- c(1e5,1e6,2e6,3e6,5e6)
> timing <- list()
> for(i in nrows){
+ dum <- peaks[1:i,]
+ timing[[length(timing)+1]] <- system.time(x<- by(dum[,2:3],
INDICES=list(dum[,1]), FUN=function(x){x}, simplify = FALSE))
+ }
> names(timing)<- nrows
> timing
$`1e+05`
   user  system elapsed
   0.050.000.05

$`1e+06`
   user  system elapsed
   1.482.984.46

$`2e+06`
   user  system elapsed
   7.25   11.39   18.65

$`3e+06`
   user  system elapsed
  16.15   25.81   41.99

$`5e+06`
   user  system elapsed
  43.22   74.72  118.09





-- 
Witold Eryk Wolski

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


Re: [R] performance of do.call("rbind")

2016-06-27 Thread Witold E Wolski
Hi Bert,

You are most likely right. I just thought that do.call("rbind", is
somehow more clever and allocates the memory up front. My error. After
more searching I did find rbind.fill from plyr which seems to do the
job (it computes the size of the result data.frame and allocates it
first).

best

On 27 June 2016 at 18:49, Bert Gunter <bgunter.4...@gmail.com> wrote:
> The following might be nonsense, as I have no understanding of R
> internals; but 
>
> "Growing" structures in R by iteratively adding new pieces is often
> warned to be inefficient when the number of iterations is large, and
> your rbind() invocation might fall under this rubric. If so, you might
> try  issuing the call say, 20 times, over 10k disjoint subsets of the
> list, and then rbinding up the 20 large frames.
>
> Again, caveat emptor.
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Mon, Jun 27, 2016 at 8:51 AM, Witold E Wolski <wewol...@gmail.com> wrote:
>> I have a list (variable name data.list) with approx 200k data.frames
>> with dim(data.frame) approx 100x3.
>>
>> a call
>>
>> data <-do.call("rbind", data.list)
>>
>> does not complete - run time is prohibitive (I killed the rsession
>> after 5 minutes).
>>
>> I would think that merging data.frame's is a common operation. Is
>> there a better function (more performant) that I could use?
>>
>> Thank you.
>> Witold
>>
>>
>>
>>
>> --
>> Witold Eryk Wolski
>>
>> __
>> 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.



-- 
Witold Eryk Wolski

__
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] refclasses question - Defining accessor function

2016-06-27 Thread Witold E Wolski
Are accessors a fancy feature that do not work?

I wanted to use accessor functions in a R refclass to hide the classes
implementation where I am using sqlite.

What I did observe is, that if I access in a method any of the fields
(in the example below field .data in method printExample) all the
accessor functions are called (even those not accessed by the function
: in this case funnydata is not accessed).

That means if any of the accessor functions is slow (in the example
the funnydata accessor sleeps for 3 s) all the fields and all
functions accessing any fields will be slow.
In the example below accessing .data or calling printExample will take 3s.

It's easy enough not to use accessor functions, so not a big deal.
Still, I lost quite a bit of time wondering what is happening.



Test <-setRefClass("Test",
   fields = list( .data = "list",
  funnydata = function(x){
Sys.sleep(3)
if(missing(x)){
  Sys.sleep(3)
}
  }
   ),
   methods = list(
 initialise=function(){ .data <<- list(a="a")},

 printExample = function(){
   print("print Example")
   print(.data)}
 )
)

test<-Test()
test$printExample()
test$.data

-- 
Witold Eryk Wolski

__
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] performance of do.call("rbind")

2016-06-27 Thread Witold E Wolski
I have a list (variable name data.list) with approx 200k data.frames
with dim(data.frame) approx 100x3.

a call

data <-do.call("rbind", data.list)

does not complete - run time is prohibitive (I killed the rsession
after 5 minutes).

I would think that merging data.frame's is a common operation. Is
there a better function (more performant) that I could use?

Thank you.
Witold




-- 
Witold Eryk Wolski

__
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] numeric inputs to sweep produce NaN...

2016-05-24 Thread Witold E Wolski
I have two inputs to sweep which are numeric (with a few NA's) but the
output is NaN. How Why?


> sum(!is.numeric(unlist(protquant)))
[1] 0
> sum(!is.numeric(normalize))
[1] 0
> normprotquant <- sweep(protquant, 2, normalize, "-" )
> sum(is.nan(unlist(normprotquant)))
[1] 31


version R 3.3.0

best regards Witold
-- 
Witold Eryk Wolski

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


Re: [R] how to manipulate ... in the argument list

2016-05-12 Thread Witold E Wolski
Duncan suggested to use the argument explicitly and combine it with
the missing function which is for this problem also my preferred
solution:


image.2 <- function(x, col , breaks, ...){
  # function is manipulating colors (adding a few)
  # since it changes colors it needs to update breaks if defined.

  if( !missing(breaks) ){
 #manipulate breaks

image(x, col, breaks  ,...)

   }else{
  image(x,col ,...)
   }
}

It is good to know that I also could have used do.call.

I also learned yesterday that it is better to search for dot dot dot
argument or for elipsis instead of  ...

best





On 11 May 2016 at 15:45, Vito M. R. Muggeo <vito.mug...@unipa.it> wrote:
> Hi Witold,
> use do.call()
>
> list.args<-list(...)
>
> #modify 'list.args' (add/delete/modify)
>
> do.call(image, list.args)
>
> best,
> vito
>
>
> Il 11/05/2016 10.45, Witold E Wolski ha scritto:
>>
>> Hi,
>>
>> I am looking for a documentation describing how to manipulate the
>> "..." . Searching R-intro.html gives to many not relevant hits for
>> "..."
>>
>> What I want to do is something like this :
>>
>>
>> image.2 <- function(x, col , ...){
>>   # function is manipulating colors (adding a few)
>>   # since it changes colors it needs to update breaks if defined.
>>
>>breaks <- list(...)$breaks
>>
>>   if( !is.null( list(...)$breaks ) ){
>>  #manipulate breaks
>>
>> image(x, col, breaks = breaks ,...)
>>
>>}else{
>>   image(x,col ,...)
>>}
>> }
>>
>> but in order to get it working I will need to remove breaks from ...
>> since otherwise I am getting multiple defined argument for breaks.
>>
>> So how to manipulate the "..." argument? Or should I use a different
>> pattern
>>
>> best
>>
>>
>>
>
> --
> ==
> Vito M.R. Muggeo
> Dip.to Sc Statist e Matem `Vianelli'
> Università di Palermo
> viale delle Scienze, edificio 13
> 90128 Palermo - ITALY
> tel: 091 23895240
> fax: 091 485726
> http://dssm.unipa.it/vmuggeo
> Associate Editor, Statistical Modelling
> ===



-- 
Witold Eryk Wolski

__
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] how to manipulate ... in the argument list

2016-05-11 Thread Witold E Wolski
Hi,

I am looking for a documentation describing how to manipulate the
"..." . Searching R-intro.html gives to many not relevant hits for
"..."

What I want to do is something like this :


image.2 <- function(x, col , ...){
 # function is manipulating colors (adding a few)
 # since it changes colors it needs to update breaks if defined.

  breaks <- list(...)$breaks

 if( !is.null( list(...)$breaks ) ){
#manipulate breaks

   image(x, col, breaks = breaks ,...)

  }else{
 image(x,col ,...)
  }
}

but in order to get it working I will need to remove breaks from ...
since otherwise I am getting multiple defined argument for breaks.

So how to manipulate the "..." argument? Or should I use a different pattern

best



-- 
Witold Eryk Wolski

__
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] packaging an R-application

2015-12-23 Thread Witold E Wolski
Dear List,


What I am seeking advice for is how to best package an R installation
with all the packages required?

Scenario:
I need to deliver an R script which will have quite a bit of package
dependencies, to packages which are not necessarily stable, are not on
cran and might dissapear in the near future. It should be possible to
execute the R-script without any changes during the next 3 years.


What I did look into is packrat. But if I am correct it pulls the
r-packages from cran so if a package was from somewhere else or isn't
available anymore it will fail.

what I have also found is R on an USB stick:
http://personal.bgsu.edu/~mrizzo/Rmisc/usbR.htm

Would this work?

Or is there anything on the lines of pyinstaller
(http://www.pyinstaller.org/) for R?


Thank you

-- 
Witold Eryk Wolski

__
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] conditionally disable evaluation of chunks in Rmarkdown...

2015-11-10 Thread Witold E Wolski
I do have an Rmd where I would like to conditionally evaluate the second part.

So far I am working with :

```{r}
if(length(specLibrary@ionlibrary) ==0){
  library(knitr)
  opts_chunk$set(eval=FALSE, message=FALSE, echo=FALSE)
}
```

Which disables the evaluation of subsequent chunks.

However my RMD file contains also these kind of snippets : `r `

How do I disable them?

regards



-- 
Witold Eryk Wolski

__
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] r-markdown - keeping figures

2015-10-20 Thread Witold E Wolski
I am running r-markdown from r-studio and can't work out how to keep
the figures.
I mean I have a few figures in the document and would like to have
them as separate pdf's too as I have been used to have them when using
Sweave.



best regards
Witold


-- 
Witold Eryk Wolski

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


Re: [R] names in R list's

2015-09-08 Thread Witold E Wolski
Hi Jeff,

Indeed there was something about plain-text in the r-help posting
guide although I can't find it there anymore.
https://www.r-project.org/posting-guide.html

Is it still an requirement?

Jeff, thanks for you constructive contribution ;) . Glad that you know
about plain text mode in e-mails, beside doing some perl programming.
I forgot about both. Even the linux admin's I know use python and
thunderbird or some webmail nowadays not pine and perl, but I do not
much networking, so what do I know.

I think the question I am asking is legitimate. The access complexity
of datastructures is specified in the documentation in case of python
datastructures,  java collections or stl containers.
I guess this information is available for name access on R-list but I
just can't find it.




regards

On 7 September 2015 at 16:37, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote:
> You puzzle me. Why does someone who cannot figure out how to post an email in 
> plain text after so many messages on this mailing list get all worried about 
> access time for string indexing?
>
> Environment objects have those properties. They do not solve all problems 
> though, because they are rather heavyweight... you need a lot of lookups to 
> pay for their overhead. R5 objects and the hash package both use them, but I 
> have never found three need to use them. Yes, I do program in Perl so I know 
> where you are coming from, but the vector-based name lookup used in R works 
> quite effectively for data where the number of list items is short or where I 
> plan to access every element as part of my data processing anyway.
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:<jdnew...@dcn.davis.ca.us>Basics: ##.#.   ##.#.  Live Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On September 7, 2015 3:34:53 AM PDT, Witold E Wolski <wewol...@gmail.com> 
> wrote:
>>What is the access time for R lists given a name of list element, is it
>>linear, log, or constant?
>>
>>Than what are to rules for names in R-lists
>>
>>That reusing names is possible makes me wonder.
>>
>>tmp <- as.list(c(1,2,3,4))
>>names(tmp) = c("a","a","b","b")
>>tmp
>>tmp$a
>>
>>
>>What I am looking for is a standard R data structure which will allow
>>me
>>for fast and name lookup.
>



-- 
Witold Eryk Wolski

__
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] names in R list's

2015-09-07 Thread Witold E Wolski
What is the access time for R lists given a name of list element, is it
linear, log, or constant?

Than what are to rules for names in R-lists

That reusing names is possible makes me wonder.

tmp <- as.list(c(1,2,3,4))
names(tmp) = c("a","a","b","b")
tmp
tmp$a


What I am looking for is a standard R data structure which will allow me
for fast and name lookup.




-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

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


Re: [R] registerDoParallel and R CMD check --as-cran errors

2015-09-03 Thread Witold E Wolski
To answer my own question. Dono if it's the right way to do... In the
example code I am using a single CPU and it works.

regards

PS. Should I have asked this question on the devel list?



On 2 September 2015 at 14:39, Witold E Wolski <wewol...@gmail.com> wrote:

> I am testing a package with
>
> R CMD check
> and
> R CMD check --as-cran
>
> some code which is run in the examples section uses the foreach and
> doParallel package.
>
>
> When run with --as-cran I have an error.
> registerDoParallel function causes an error.
>
> Error in .check_ncores(length(names)) : 6 simultaneous processes spawned
> Calls: annotatePeptides ... registerDoParallel -> makeCluster ->
> makePSOCKcluster -> .check_ncores
>
>
> What should can I do to prevent this error and pas the --as-cran check?
>
> best regards
> Witold
>
>
> --
> Witold Eryk Wolski
>
>


-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

__
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] registerDoParallel and R CMD check --as-cran errors

2015-09-02 Thread Witold E Wolski
I am testing a package with

R CMD check
and
R CMD check --as-cran

some code which is run in the examples section uses the foreach and
doParallel package.


When run with --as-cran I have an error.
registerDoParallel function causes an error.

Error in .check_ncores(length(names)) : 6 simultaneous processes spawned
Calls: annotatePeptides ... registerDoParallel -> makeCluster ->
makePSOCKcluster -> .check_ncores


What should can I do to prevent this error and pas the --as-cran check?

best regards
Witold


-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

__
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] data - stringAsFactors = FALSE

2015-09-01 Thread Witold E Wolski
I have a tab delimited table in the data directory of a package.

I would like that when loading this data with
data(tablename)

in the example section the strings are not coerced to factors.

How can I achieve it? Or should I move this tables to the inst/extdata
directory and load them with read.table?

regards



-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

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


Re: [R] compiling Rmd - can't find tex file....

2015-08-27 Thread Witold E Wolski
to answer my own question.

I did not find out what knit2pdf is good for
but rmarkdown::render does the job.

regards




On 26 August 2015 at 11:46, Witold E Wolski wewol...@gmail.com wrote:

 I am using from within R-studio and the .Rmd file builds nicely.

 However, when I try to compile the fiel using :

 knit2pdf( specL.Rmd, output=file.path(res.12345,specL.pdf) )
 I am getting tex errors (see below). When I wan't to check what's wrong I
 can't find the tex file.
 Any ideas?

 Thank you


 PS: Errors:

  |..   |  95%

 label: writepepProt

   |.| 100%

   ordinary text without R code



 *output file: res.12345/specL.pdf*


 *Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,
 : *

 *  Running 'texi2dvi' on 'specL.pdf' failed.*

 *LaTeX errors:*

 *! Missing $ inserted.*

 *inserted text *

 *$*

 *to be read again *

 *   _*

 *! Missing $ inserted.*

 *inserted text *

 *$*

 *to be read again *

 *   \par *

 *! You can't use `macro parameter character #' in horizontal mode.*

 *l.15 #*






 --
 Witold Eryk Wolski




-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

__
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] compiling Rmd - can't find tex file....

2015-08-26 Thread Witold E Wolski
I am using from within R-studio and the .Rmd file builds nicely.

However, when I try to compile the fiel using :

knit2pdf( specL.Rmd, output=file.path(res.12345,specL.pdf) )
I am getting tex errors (see below). When I wan't to check what's wrong I
can't find the tex file.
Any ideas?

Thank you


PS: Errors:

 |..   |  95%

label: writepepProt

  |.| 100%

  ordinary text without R code



*output file: res.12345/specL.pdf*


*Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,
: *

*  Running 'texi2dvi' on 'specL.pdf' failed.*

*LaTeX errors:*

*! Missing $ inserted.*

*inserted text *

*$*

*to be read again *

*   _*

*! Missing $ inserted.*

*inserted text *

*$*

*to be read again *

*   \par *

*! You can't use `macro parameter character #' in horizontal mode.*

*l.15 #*






-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

__
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] Faster text search in document database than with grep?

2015-08-03 Thread Witold E Wolski
I have a database of text documents (letter sequences). Several thousands
of documents with approx. 1000-2000 letters each.

I need to find exact matches of short 3-15 letters sequences in those
documents.

Without any regexp patterns the search of one 3-15 letter words takes in
the order of 1s.

So for a database with several thousand documents it's an the order of
hours.
The naive approach would be to use mcmapply, but than on a standard
hardware I am still in the same order and since R is an interactive
programming environment this isn't a solution I would go for.

But aren't there faster algorithmic solutions? Can anyone point me please
to an implementation  available in R.

Thank you
Witold




-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

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


Re: [R] Faster text search in document database than with grep?

2015-08-03 Thread Witold E Wolski
Dear Duncan,

This is a model of the data I work with.

database - replicate(5, paste(sample(letters,rexp(1,1/500), rep=TRUE),
   collapse=))

words - replicate(1,paste(sample(letters,rexp(1,1/70), rep=TRUE),
   collapse=))

NumberOfWords - 10
system.time(lapply(words[1: NumberOfWords], grep, database))
   user  system elapsed
  5.002   0.003   5.005

 The model reproduces the running times I have to cope with.

To use grep in this context is rather naive and I am wondering if there are
better solutions availabe in R.



On 3 August 2015 at 15:13, Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On 03/08/2015 5:25 AM, Witold E Wolski wrote:
  I have a database of text documents (letter sequences). Several thousands
  of documents with approx. 1000-2000 letters each.
 
  I need to find exact matches of short 3-15 letters sequences in those
  documents.
 
  Without any regexp patterns the search of one 3-15 letter words takes
 in
  the order of 1s.
 
  So for a database with several thousand documents it's an the order of
  hours.
  The naive approach would be to use mcmapply, but than on a standard
  hardware I am still in the same order and since R is an interactive
  programming environment this isn't a solution I would go for.
 
  But aren't there faster algorithmic solutions? Can anyone point me please
  to an implementation  available in R.

 You haven't shown us what you did, but it sounds far slower than I'd
 expect.  I just used the code below to set up a database of 1
 documents of 2000 letters each, and searching those documents for abc
 takes about 70 milliseconds:

 database - replicate(1, paste(sample(letters, 2000, rep=TRUE),
 collapse=))

 grep(abc, database, fixed=TRUE)

 Duncan Murdoch




-- 
Witold Eryk Wolski

[[alternative HTML version deleted]]

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


Re: [R] sort order of a character sequence is different on windose and linux (linux result)

2014-07-08 Thread Witold E Wolski
From my reading of
http://r.789695.n4.nabble.com/internal-string-comparison-Scollate-td4687584.html
they have good arguments to ask for Scollate whatever it is in the R public API.


And from my point of view R would benefit from a tight integration of
data.table.
Without data.table R is very impractical to use, with data which is
avaiable today.

On 6 July 2014 14:15, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 06/07/2014, 7:56 AM, Witold E Wolski wrote:
 This is the info I got from the data.table developers... Seems that
 they did have tried to find a more elegant solution solution.:

 From my reading of the response below, data.table doesn't use R's sort()
 function to do their sorting.  You should use whatever sort function
 they use if you want to match their sort order.

 Duncan Murdoch



 data.table used to support this until 1.8.6. But since Scollate became
 not a part of authorised R-API (IIUC) anymore at some point,
 data.table only supports sort/order under the C-locale.

 data.table's ordering/sorting is over 10-20x faster than base's and
 the only way right now (IIUC) to sort by locale is to use base's
 sort/order.

 This post may give some more insight.
 http://r.789695.n4.nabble.com/internal-string-comparison-Scollate-td4687584.html

 In summary, we support only C-locale.


 On 6 July 2014 13:33, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 06/07/2014, 7:19 AM, Witold E Wolski wrote:
 It seems that the package I am developing depends on the locale C
 because of interactions with other packages (data.table).

 So I would like to set the locale to C as soon as the package is loaded.
 Where can I do it .. I could of course set it in every function in my
 package but...


 As the help page says, you can't do it reliably on all platforms, and
 you really shouldn't even try:  that will affect other things that the
 user does.

 You will need to find another solution to your problem.

 Duncan Murdoch







-- 
Witold Eryk Wolski

__
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] sort order of a character sequence is different on windose and linux (linux result)

2014-07-06 Thread Witold E Wolski
This is the result of sorting a character sequence on a linux box
(with R . 3.10)

 bla = read.table(xx.txt,stringsAsFactors=F)
 bla = bla[,1]
 bla[1:10]
 [1] 1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
1000_DGFVALSK_2_run0
 [6] 1000_DGFVALSK_2_run0   1001_DGGAWGTEQR_2_run0
1001_DGGAWGTEQR_2_run0 1001_DGGAWGTEQR_2_run0
1001_DGGAWGTEQR_2_run0
 sort(bla)[1:10]
 [1] 1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
1000_DGFVALSK_2_run0
 [6] 1000_DGFVALSK_2_run0   1001_DGGAWGTEQR_2_run0
1001_DGGAWGTEQR_2_run0 1001_DGGAWGTEQR_2_run0
1001_DGGAWGTEQR_2_run0


I will send the result of sorting the content of xx.txt on windows
from the windows box in a moment.

the file xx.txt can be found at:
https://github.com/wolski/imsbInfer/blob/master/xx.txt



-- 
Witold Eryk Wolski

__
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] sort order of a character sequence is different on windose and linux (windows result)

2014-07-06 Thread Witold E Wolski
And here is the result when sorting the same sequence on a windows box:


 bla = read.table(xx.txt,stringsAsFactors=F)
 bla = bla[,1]
 bla[1:10]
 [1] 1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
 [5] 1000_DGFVALSK_2_run0   1000_DGFVALSK_2_run0
1001_DGGAWGTEQR_2_run0 1001_DGGAWGTEQR_2_run0
 [9] 1001_DGGAWGTEQR_2_run0 1001_DGGAWGTEQR_2_run0
 sort(bla)[1:10]
 [1] 1_AAALQAK_2_run0  1_AAALQAK_2_run0
1_AAALQAK_2_run0  1_AAALQAK_2_run0
 [5] 1_AAALQAK_2_run0  1_AAALQAK_2_run0
10_AAATAEEPDPK_2_run0 10_AAATAEEPDPK_2_run0
 [9] 10_AAATAEEPDPK_2_run0 10_AAATAEEPDPK_2_run0


-- 
Witold Eryk Wolski

__
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] sort order of a character sequence is different on windose and linux (linux result)

2014-07-06 Thread Witold E Wolski
It seems that the package I am developing depends on the locale C
because of interactions with other packages (data.table).

So I would like to set the locale to C as soon as the package is loaded.
Where can I do it .. I could of course set it in every function in my
package but...

__
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] sort order of a character sequence is different on windose and linux (linux result)

2014-07-06 Thread Witold E Wolski
This is the info I got from the data.table developers... Seems that
they did have tried to find a more elegant solution solution.:


data.table used to support this until 1.8.6. But since Scollate became
not a part of authorised R-API (IIUC) anymore at some point,
data.table only supports sort/order under the C-locale.

data.table's ordering/sorting is over 10-20x faster than base's and
the only way right now (IIUC) to sort by locale is to use base's
sort/order.

This post may give some more insight.
http://r.789695.n4.nabble.com/internal-string-comparison-Scollate-td4687584.html

In summary, we support only C-locale.


On 6 July 2014 13:33, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 06/07/2014, 7:19 AM, Witold E Wolski wrote:
 It seems that the package I am developing depends on the locale C
 because of interactions with other packages (data.table).

 So I would like to set the locale to C as soon as the package is loaded.
 Where can I do it .. I could of course set it in every function in my
 package but...


 As the help page says, you can't do it reliably on all platforms, and
 you really shouldn't even try:  that will affect other things that the
 user does.

 You will need to find another solution to your problem.

 Duncan Murdoch



-- 
Witold Eryk Wolski

__
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 does a valid subscript can produce an subscript out of bounds error?

2014-07-05 Thread Witold E Wolski
Thank you. You example helped to FIX IT.

The problem is I guess somehow related to:
 class(msexp$pepinfo$transition_group_id)
[1] factor

and the whole R type conversion , riddle.

For subscripts my intuition is:  either require integer or do the
cast to the rowname type (character).
However, it seems that R somehow prefers to cast factors to integers...

it seems that %in% casts both vectors to the same type. But to which one?

Oh, I guess all this is neatly explained in the R standard ... but
websearching for it just returns:
standard deviation


a frustrated R user.

On 5 July 2014 02:18, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 04/07/2014, 6:35 PM, Witold E Wolski wrote:
 how does a valid subscript (see first 2 lines) can produce an
 subscript out of bounds error (see line 4)?


 1 sum(!rownames(msexp$rt) %in% msexp$pepinfo$transition_group_id)
 [1] 0
 2 sum(!msexp$pepinfo$transition_group_id %in% rownames(msexp$rt))
 [1] 0
 3 class(msexp$rt)
 [1] matrix
 4 msexp$rt = as.matrix(msexp$rt[msexp$pepinfo$transition_group_id,])
 Error in msexp$rt[msexp$pepinfo$transition_group_id, ] :
   subscript out of bounds



 x - matrix(1,1,1)
 rownames(x) - colnames(x) - 23
 23 %in% rownames(x)
 [1] TRUE
 x[23,]
 Error in x[23, ] : subscript out of bounds




-- 
Witold Eryk Wolski

__
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] data.table merge question...

2014-07-04 Thread Witold E Wolski
Actually the question is regarding differences in behaviour on windows in linux.
The 2 lines of code produce on linux all TRUE 
on windows this looks heterogenous...

Using merge.data.frame produces on all platforms TRUE ...


 msexp$pepinfo = 
 data.frame(merge(tt,msexp$pepinfo,by=transition_group_id),stringsAsFactors=FALSE)
 tt$transition_group_id == msexp$pepinfo$transition_group_id

  [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [23]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [45]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE
 [67] FALSE FALSE FALSE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE
 [89] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE
[111] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE ...


-- 
Witold Eryk Wolski

__
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 does a valid subscript can produce an subscript out of bounds error?

2014-07-04 Thread Witold E Wolski
how does a valid subscript (see first 2 lines) can produce an
subscript out of bounds error (see line 4)?


1 sum(!rownames(msexp$rt) %in% msexp$pepinfo$transition_group_id)
[1] 0
2 sum(!msexp$pepinfo$transition_group_id %in% rownames(msexp$rt))
[1] 0
3 class(msexp$rt)
[1] matrix
4 msexp$rt = as.matrix(msexp$rt[msexp$pepinfo$transition_group_id,])
Error in msexp$rt[msexp$pepinfo$transition_group_id, ] :
  subscript out of bounds


-- 
Witold Eryk Wolski

__
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 document an S3 class?

2014-06-30 Thread Witold E Wolski
Hi,

How do I document an S3 class with roxygen2?


I create the class at the end of the method with:
class(res) - myclass

but how do I create an documentation entry for this class, where I can
describe the fields of the class (in case of myclass these are just
list entries)?

regards





-- 
Witold Eryk Wolski

__
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] correlation given p value and sample size

2014-06-16 Thread Witold E Wolski
Hi,


Looking for and function which produces the minimum r (pearson
correlation) so that H0 (r=0) can be rejected, given sample size and
p-value?


Witold

-- 
Witold Eryk Wolski

__
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] Rscript and roxygen error

2014-05-26 Thread Witold E Wolski
I do want to run a R script (runrox.sh) containing two commands:

library(roxygen2)
roxygenize(imsbInfer)

When pasting these 2 lines into R they run with no error.

But when calling:

Rscript runrox.sh

the script produces this error:

roxygen fails with
Error: Failure in roxygen block beginning analyzeDuplicatedPeptides.R:1
could not find function is
Execution halted



-- 
Witold Eryk Wolski

__
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] Rscript and roxygen error

2014-05-26 Thread Witold E Wolski
the same script which is not working with Rscript does work with R CMD BATCH.

I thought the main difference between Rscript and R CMD BATCH is where
the ouptut gets redirected and that Rscript should preferred over the
old R CMD BATCH.






On 26 May 2014 15:12, Witold E Wolski wewol...@gmail.com wrote:
 I do want to run a R script (runrox.sh) containing two commands:

 library(roxygen2)
 roxygenize(imsbInfer)

 When pasting these 2 lines into R they run with no error.

 But when calling:

 Rscript runrox.sh

 the script produces this error:

 roxygen fails with
 Error: Failure in roxygen block beginning analyzeDuplicatedPeptides.R:1
 could not find function is
 Execution halted



 --
 Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
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 build and check an package on a system without tex latex?

2014-05-26 Thread Witold E Wolski
This is what I tried:
R CMD check $(PKGNAME)_$(PKGVERS).tar.gz --no-manual --no-rebuild-vignettes
R CMD build --no-manual --no-rebuild-vignettes $(PKGSRC)

But still somehow the R CMD build attempts to build the vignettes (OK
with me), but also run
texi2dvi on them producing the error message below:


Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
Running 'texi2dvi' on 'AExample2.tex' failed.
Messages:
sh: 1: /usr/bin/texi2dvi: not found
Calls: Anonymous - texi2pdf - texi2dvi
Execution halted
make: *** [build] Error 1




-- 
Witold Eryk Wolski

__
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] Documenting docType data

2014-05-20 Thread Witold E Wolski
Hi,

I am Trying to document data using roxygen2 by following the
stackoverflow question:
http://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2


And although my data resigin in mypackage/data
has extension .rda and .csv

I am getting the same error as in the stackoverlfow issue:

** testing if installed package can be loaded
Error in namespaceExport(ns, exports) :
  undefined exports: feature_alignment_requant
Error: loading failed
Execution halted
ERROR: loading failed

best regards
Witold


-- 
Witold Eryk Wolski

__
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] Documenting docType data

2014-05-20 Thread Witold E Wolski
Thanks a lot. I still had an @export.

On 20 May 2014 14:34, Hadley Wickham h.wick...@gmail.com wrote:
 Don't export the dataset? (as mentioned in the answer to that
 question). If that doesn't help, please supply a minimal reproducible
 example.

 Hadley

 On Tue, May 20, 2014 at 3:35 AM, Witold E Wolski wewol...@gmail.com wrote:
 Hi,

 I am Trying to document data using roxygen2 by following the
 stackoverflow question:
 http://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2


 And although my data resigin in mypackage/data
 has extension .rda and .csv

 I am getting the same error as in the stackoverlfow issue:

 ** testing if installed package can be loaded
 Error in namespaceExport(ns, exports) :
   undefined exports: feature_alignment_requant
 Error: loading failed
 Execution halted
 ERROR: loading failed

 best regards
 Witold


 --
 Witold Eryk Wolski

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



 --
 http://had.co.nz/



-- 
Witold Eryk Wolski

__
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] dist like function but where you can configure the method

2014-05-16 Thread Witold E Wolski
Dear Jari,

Thanks for your reply...

The overhead would be
2 for loops
for(i in 1:dim(x)[2])
for(j in i:dim(x)[2])

isn't it? Or are you seeing a different way to implement it?

A for loop is pretty expensive in R. Therefore I am looking for an
implementation similar to apply or lapply were the iteration is made
in native code.





On 16 May 2014 15:57, Jari Oksanen jari.oksa...@oulu.fi wrote:
 Witold E Wolski wewolski at gmail.com writes:


 Looking for an  fast dist implementation
 where I could pass my own dist function to the method parameter

 i.e.

 mydistfun = function(x,y){
  return(ks.test(x,y)$p.value)   #some mystique implementation
 }

 wow = dist(data,method=mydistfun)

 I think it is best to write that function yourself.

 The dist object is a vector corresponding to a lower triangle
 (without the diagonal) of a symmetric matrix and with attributes.
 The attributes are class which should be c(mydist, dist), Size
 which is the length(x), Labels (optional) which are the
 names of your items and if given, should have length(x),
 call = match.call(), Diag = FALSE, Upper = FALSE and method name.
 All you need is a vector with attributes.

 All this will add very little overhead to your calculation, so
 for all practical purposes this implementation is just as fast as
 is your mystique implementation of pairwise distances. Your
 example (ks.test()) probably would be pretty slow. If you can
 vectorize your distance, it can be really fast, even if you
 calculate the full symmetric matrix and throw away the diagonal and
 upper triangle.

 Cheers, Jari Oksanen

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



-- 
Witold Eryk Wolski

__
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] dist like function but where you can configure the method

2014-05-16 Thread Witold E Wolski
Ouch,

First : my question was not how to implement dist but if there is a
more generic dist function than stats:dist.

Secondly: ks.test is ment as a placeholder (see the comment in the
code I did send) for any other function taking two vector arguments.

Third: I do subscribe to the idea that a function call is easier to
read and understand than a for loop. @Bert apply is a native C
function and the loop is not interpreted AFAIK

@Rui @Barry @Jari What do you benchmark? an empty loop?

Look at the trivial benchmarks below: _apply_ clearly outperforms a
for loop in R , It always has, it outperforms even an empty for

# an empty unrealistic for loop as suggested by Rui , Barry and Jari
f1 - function(n){
  for(i in 1:n){
for(j in 1:n){
}
  }}


myfunc = function(x,y=x){x-y}

# a for loop which does actually something
f2 - function(n){
  mm - matrix(0,ncol=n,nrow=n)
  for(i in 1:n){
for(j in 1:n){
  mm[i,j] = myfunc(i,j)
}
  }
  return(mm)
}

# and array
f3 = function(n){
  res = rep(0,n*n)
  for(i in 1:(n*n))
  {
res[i] = myfunc(i)
  }
}


n = 1000
system.time(f1(n))
system.time(f2(n))
system.time(f3(n))
system.time(apply(t(1:(n*n)),1,myfunc))


 system.time(f1(n))
   User  System verstrichen
   0.280.000.28
 system.time(f2(n))
   User  System verstrichen
   6.800.007.09
 system.time(f3(n))
   User  System verstrichen
   5.830.005.98
 system.time(apply(t(1:(n*n)),1,myfunc))
   User  System verstrichen
   0.190.000.19






On 16 May 2014 20:55, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 The compiler package is good at speeding up for loops but in this case the
 gain is neglectable. The ks test is the real time problem.

 library(compiler)

 f1 - function(n){

 for(i in 1:100){
 for(i in 1:100){
 ks.test(runif(100),runif(100))
 }
 }
 }

 f1.c - cmpfun(f1)

 system.time(f1())
user  system elapsed
3.500.003.53
 system.time(f1.c())
user  system elapsed
3.470.003.48


 Rui Barradas

 Em 16-05-2014 17:12, Barry Rowlingson escreveu:

 On Fri, May 16, 2014 at 4:46 PM, Witold E Wolski wewol...@gmail.com
 wrote:

 Dear Jari,

 Thanks for your reply...

 The overhead would be
 2 for loops
 for(i in 1:dim(x)[2])
 for(j in i:dim(x)[2])

 isn't it? Or are you seeing a different way to implement it?

 A for loop is pretty expensive in R. Therefore I am looking for an
 implementation similar to apply or lapply were the iteration is made
 in native code.


 No, a for loop is not pretty expensive in R -- at least not compared
 to doing a k-s test:

system.time(for(i in 1:1){ks.test(runif(100),runif(100))})
 user  system elapsed
3.680   0.012   3.697

   3.68 seconds to do 1 ks tests (and generate 200 runifs)

system.time(for(i in 1:1){})
 user  system elapsed
0.000   0.000   0.001

   0.000s time to do 1 loops. Oh lets nest it for fun:

system.time(for(i in 1:100){for(i in
 1:100){ks.test(runif(100),runif(100))}})
 user  system elapsed
3.692   0.004   3.701

   no different. Even a ks-test with only 5 items is taking me 2.2 seconds.

 Moral: don't worry about the for loops.

 Barry

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





-- 
Witold Eryk Wolski

__
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] dist like function but where you can configure the method

2014-05-15 Thread Witold E Wolski
Looking for an  fast dist implementation
where I could pass my own dist function to the method parameter


i.e.

mydistfun = function(x,y){
 return(ks.test(x,y)$p.value)   #some mystique implementation
}


wow = dist(data,method=mydistfun)


thanks


-- 
Witold Eryk Wolski

__
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] S3 - how to implement colnames-

2014-05-14 Thread Witold E Wolski
Have a class for which I would like to provide a colnames-.myclass
function so that

colnames(myintsance) - c(a,b,c)
can be called.

Witold


-- 
Witold Eryk Wolski

[[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] S3 - how to implement colnames-

2014-05-14 Thread Witold E Wolski
Hi

So how would I actually implement it - what is the signature?


dimnames-.myclass - function(data,newnames){
colnames(data) = newnames
return(data)
}

?



On 14 May 2014 11:53, Martin Maechler maech...@stat.math.ethz.ch wrote:

 DO *NOT*  post to both R-help and R-devel !!
 That is considered *very* impolite.

 As this is a question for R-help  only, i.e., not fit for
 R-devel anyway :

  Witold E Wolski wewol...@gmail.com
  on Wed, 14 May 2014 10:57:09 +0200 writes:

  Have a class for which I would like to provide a colnames-.myclass
  function so that

  colnames(myintsance) - c(a,b,c)
  can be called.

 This is not easily possible, as `colnames-` is *not* a generic
 function.  OTOH, this is not necessary either, as
 colnames, rownames are basically just short cuts for dimnames anyway:

 As  `dimnames-` *is* a generic function,
 so you write methods for `dimnames-`.

 Martin

  --
  Witold Eryk Wolski

  [[alternative HTML version deleted]]
  ^^
 Hmm,...




-- 
Witold Eryk Wolski

[[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] roxygen2 question

2014-05-14 Thread Witold E Wolski
How to document S3Methods with roxygen so that I have only 1 entry in
the package documentation page per S3Method.

In the package documentation page they show up than as follows

read2msExperiment read 2 feature alginer long format and generate an
msexperiment
read2msExperiment.data.frame convert data.frame 2 msexperiment
read2msExperiment.default read 2 feature alginer long format and
generate an msexperiment


I did alias read2msExperiment in the documentation of
read2msExperiment.default but this only helps that read2msExperiment
points to the documentation of read2msExperiment.default.

What I would like to have is one entry in the package documentation
page for all s3Methods:

This is my roxygen code at the moment.


#' @export
read2msExperiment=function(obj,...){
  UseMethod('read2msExperiment')
}
#' read 2 feature alginer long format and generate an msexperiment
#' @aliases read2msExperiment
#' @param filename filename to read (can't be compressed)
#' @return msexperiment
#' @export
read2msExperiment.default=function(filename){
  print(read2msExperiment.default)
  aligtable=fread(filename)
  data = convertLF2Wideformat(aligtable)
  data = convert2msExperiment(data)
  return(data)
}





-- 
Witold Eryk Wolski

__
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] installing r on ubuntu ?

2014-04-07 Thread Witold E Wolski
Hi,

trying to install newest R on ubuntu

I follow the instructions at:
 http://cran.at.r-project.org/bin/linux/ubuntu/


I added:

deb http://cran.r-mirror.de/bin/linux/ubuntu saucy/

to:
/etc/apt/sources.list


running :

sudo apt-get update

produces :
W: GPG error: http://cran.r-mirror.de saucy/ Release: The following
signatures couldn't be verified because the public key is not
available: NO_PUBKEY 51716619E084DAB9

??


regards
Witold


-- 
Witold Eryk Wolski

__
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 check capabilities of an graphics device?

2014-03-24 Thread Witold E Wolski
Before plotting to an device, I would like check which
capabilities/properties it has to avoid
warnings such as:

In plot.xy(xy, type, ...) :
  semi-transparency is not supported on this device: reported only once per page




-- 
Witold Eryk Wolski

__
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] Can't write to an device after catching a warning.

2014-03-24 Thread Witold E Wolski
I have some code to handle warnings thrown because a device does not
support some features:

bla = tryCatch(
plot(d$ratio,-log10(d$pvals),col=#0033,pch=19,xlab=xlab,
ylab=ylab),
  warning=function(bla){dev.off();  return(1)}
  )
if(!is.null(bla)){
   plot(d$ratio,-log10(d$pvals),col=1,pch=19,xlab=xlab, ylab=ylab)
}

Problem with the code above is that I need to call dev.off() in the
function handling warnings
function(bla){dev.off();  return(1)}

The dev.off() in the tryCatch closes the device and alle commands send
to the device (i.e. par(mforw=c(2,2)) are lost.


However, if I don't call dev.off(), all what I write to the device
next (i.e. in the subsequent if statment) is'nt plotted. The device
appears to be blocked.


regard


-- 
Witold Eryk Wolski

__
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] data.table - How do I transform a set of column?

2014-03-17 Thread Witold E Wolski
I started to use the data.table to subset, reshape large data.
But how do I transform a set of columns?

# for a data.frame I would do:

df = data.frame(a = c(a,b,c,d), b = 1:4,c = 1:4)
df[,2:3] = df[,2:3]^2


# but with data.table this somehow similar code produces an error.

dt = data.table(a = c(a,b,c,d), b = 1:4,c = 1:4)
dt[, 2:3 , with=FALSE ] = x[,2:3,with=FALSE]^2


By the way.

I need the columns selection 2:3 because column 1 in data.table
contains the keys.
With data.frame, matrix I would store the keys as rownames.
and just write:
df = df^2
(easier to read)


Is there syntactic sugar in data.table to be able to say something like:
transform all nonkey columns, replace all nonkey columns?


best regards
Witold









-- 
Witold Eryk Wolski

__
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] data.table and R package check

2014-03-14 Thread Witold E Wolski
Hi,

using data.table in package code i.e

setkey(aligtable,transition_group_id,align_origfilename)
aligtable = aligtable[CJ(unique(transition_group_id),
unique(align_origfilename))]

When I do run R package check I got warnings such as:

convert2msExperiment: no visible binding for global variable
  'transition_group_id'

 and more and more and MORE

I can't suppress those warnings by putting transition_group_id into
quotes because
this would break this code:

aligtable = aligtable[CJ(unique(transition_group_id),
unique(align_origfilename))]


Any alternatives?

regards









-- 
Witold Eryk Wolski

__
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] stats::runmed - crashes R - session

2014-02-03 Thread Witold E Wolski
R version 3.0.1 (2013-05-16) -- Good Sport
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)


 length(log2ro)
[1] 16152
 summary(log2ro)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.NA's
-10   0   0 Inf   0 Inf   10461


 tmpInt = runmed( log2ro,k=501)
No output shown since segfault.

Does anyone from R Core would like to look into it? I can provide the dataset.

regards



-- 
Witold Eryk Wolski

__
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] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Witold E Wolski
Looking for a build in function which returns a vector of the
positions of _ALL_ matches.




-- 
Witold Eryk Wolski

__
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] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Witold E Wolski
Hi Petr,

I was actually citing the match (%in%) docu -
match returns the positions of (first) matches.

I am looking for something returning ALL matches (sure it's
easy to write a function which does it ...
my intuition however is, that there is already such a function in R - is there
something which isn't already implemented in R? Not that I know of. )

regarding :

which(table == match)

in case table is a vector the output produced is going to be:

Warning message:
In table == match :
  longer object length is not a multiple of shorter object length



regards


On 3 February 2014 11:36, PIKAL Petr petr.pi...@precheza.cz wrote:
 Hi

 which(table == match)

 or

 which(table %in% match)

 Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Witold E Wolski
 Sent: Monday, February 03, 2014 11:19 AM
 To: r-help@r-project.org
 Subject: [R] match - returns a vector of the positions of (first)
 matches - looking for All positions.

 Looking for a build in function which returns a vector of the positions
 of _ALL_ matches.




 --
 Witold Eryk Wolski

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

 
 Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou 
 určeny pouze jeho adresátům.
 Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
 jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
 svého systému.
 Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
 jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
 Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
 zpožděním přenosu e-mailu.

 V případě, že je tento e-mail součástí obchodního jednání:
 - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, 
 a to z jakéhokoliv důvodu i bez uvedení důvodu.
 - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
 Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany 
 příjemce s dodatkem či odchylkou.
 - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
 dosažením shody na všech jejích náležitostech.
 - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
 žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
 pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu 
 případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je 
 adresátovi či osobě jím zastoupené známá.

 This e-mail and any documents attached to it may be confidential and are 
 intended only for its intended recipients.
 If you received this e-mail by mistake, please immediately inform its sender. 
 Delete the contents of this e-mail with all attachments and its copies from 
 your system.
 If you are not the intended recipient of this e-mail, you are not authorized 
 to use, disseminate, copy or disclose this e-mail in any manner.
 The sender of this e-mail shall not be liable for any possible damage caused 
 by modifications of the e-mail or by delay with transfer of the email.

 In case that this e-mail forms part of business dealings:
 - the sender reserves the right to end negotiations about entering into a 
 contract in any time, for any reason, and without stating any reasoning.
 - if the e-mail contains an offer, the recipient is entitled to immediately 
 accept such offer; The sender of this e-mail (offer) excludes any acceptance 
 of the offer on the part of the recipient containing any amendment or 
 variation.
 - the sender insists on that the respective contract is concluded only upon 
 an express mutual agreement on all its aspects.
 - the sender of this e-mail informs that he/she is not authorized to enter 
 into any contracts on behalf of the company except for cases in which he/she 
 is expressly authorized to do so in writing, and such authorization or power 
 of attorney is submitted to the recipient or the person represented by the 
 recipient, or the existence of such authorization is known to the recipient 
 of the person represented by the recipient.



-- 
Witold Eryk Wolski

__
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] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Witold E Wolski
Thank you. That's what I was looking for.

I am  wondering what does the documentation means by (first) than?

match {base}
match returns a vector of the positions of (first) matches of its
first argument in its second.





On 3 February 2014 15:02, PIKAL Petr petr.pi...@precheza.cz wrote:
 Hi

 Posting questions without context may result in answers unrelated to your 
 problem.

 Anyway it works for me without problem

 table-sample(letters[1:5], 20, replace=T)
 which(table %in% a)
 [1]  1  2 19

 version
_
 platform   i386-w64-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status Under development (unstable)
 major  3
 minor  1.0
 year   2013
 month  12
 day19
 svn rev64488
 language   R
 version.string R Under development (unstable) (2013-12-19 r64488)
 nickname   Unsuffered Consequences

 Regards
 Petr


 -Original Message-
 From: Witold E Wolski [mailto:wewol...@gmail.com]
 Sent: Monday, February 03, 2014 1:07 PM
 To: PIKAL Petr
 Cc: r-help@r-project.org
 Subject: Re: [R] match - returns a vector of the positions of (first)
 matches - looking for All positions.

 Hi Petr,

 I was actually citing the match (%in%) docu - match returns the
 positions of (first) matches.

 I am looking for something returning ALL matches (sure it's easy to
 write a function which does it ...
 my intuition however is, that there is already such a function in R -
 is there something which isn't already implemented in R? Not that I
 know of. )

 regarding :

 which(table == match)

 in case table is a vector the output produced is going to be:

 Warning message:
 In table == match :
   longer object length is not a multiple of shorter object length



 regards


 On 3 February 2014 11:36, PIKAL Petr petr.pi...@precheza.cz wrote:
  Hi
 
  which(table == match)
 
  or
 
  which(table %in% match)
 
  Petr
 
 
  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org] On Behalf Of Witold E Wolski
  Sent: Monday, February 03, 2014 11:19 AM
  To: r-help@r-project.org
  Subject: [R] match - returns a vector of the positions of (first)
  matches - looking for All positions.
 
  Looking for a build in function which returns a vector of the
  positions of _ALL_ matches.
 
 
 
 
  --
  Witold Eryk Wolski
 
  __
  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.
 
  
  Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a
 jsou určeny pouze jeho adresátům.
  Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
 neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho
 kopie vymažte ze svého systému.
  Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento
 email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
  Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou
 modifikacemi či zpožděním přenosu e-mailu.
 
  V případě, že je tento e-mail součástí obchodního jednání:
  - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
 smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
  - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně
 přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky
 ze strany příjemce s dodatkem či odchylkou.
  - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
 výslovným dosažením shody na všech jejích náležitostech.
  - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
 společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně
 zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly
 adresátovi tohoto emailu případně osobě, kterou adresát zastupuje,
 předloženy nebo jejich existence je adresátovi či osobě jím zastoupené
 známá.
 
  This e-mail and any documents attached to it may be confidential and
 are intended only for its intended recipients.
  If you received this e-mail by mistake, please immediately inform its
 sender. Delete the contents of this e-mail with all attachments and its
 copies from your system.
  If you are not the intended recipient of this e-mail, you are not
 authorized to use, disseminate, copy or disclose this e-mail in any
 manner.
  The sender of this e-mail shall not be liable for any possible damage
 caused by modifications of the e-mail or by delay with transfer of the
 email.
 
  In case that this e-mail forms part of business dealings:
  - the sender reserves the right to end negotiations about entering
 into a contract in any time, for any reason, and without stating any
 reasoning.
  - if the e-mail contains an offer, the recipient is entitled to
 immediately accept such offer; The sender

[R] image plot with color scale

2013-11-19 Thread Witold E Wolski
I am plotting an image of correlations but need to add a color scale...

dat-matrix(rnorm(1000),ncol=5)
labels=c(a,b,c,d,e)
cortmp - cor(dat)

image(cortmp , axes = F )
axis( 1, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = 45,las=2,cex=1)
axis( 2, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = -45,las=1,cex=1)


 tried image.plot from package fields but :

image.plot(cortmp , axes = F )
axis( 1, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = 45,las=2,cex=1)
axis( 2, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = -45,las=1,cex=1)


but adding the axis fails... (the axis appears but the labls are not shown.

Can anyone can suggest an easy to use image function in R?

best
Witold

-- 
Witold Eryk Wolski

__
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] writing blobs with RDBI

2013-11-05 Thread Witold E Wolski
How to write a blob with RDBI?

assuming I have
x - 1:10 * 0.1

How do I store it in a sql table as an blob?

regards




-- 
Witold Eryk Wolski

__
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] pairs plot

2013-10-10 Thread Witold E Wolski
my data are matrix with 3 numeric columns.

would like to have pairs plot
with scatterplots in the upper
with hist at the diag
and with correlation at the lower.

actually default pairs does almost what I want but looks semi awesome.
Especially, i didn't find out how to remove the axes from the lower
part where I do only want to display the numeric values correlations
there and somehow axes don't fit.

Hence I am looking at ggpairs from GGally
and calling it without parameters looks almost perfect :
but I cant find out how they got the Corr: in the upper, so I can't
put it in the lower,
and I do not know how to put the hist in the diag.

please help






-- 
Witold Eryk Wolski

__
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 pairs plot without axes

2013-10-09 Thread Witold E Wolski
In the pairs help is an example how to plot the correlation as txt.
How do I get rid of the axes
in the upper panel?

regards



## put (absolute) correlations on the upper panels,
## with size proportional to the correlations.
panel.cor - function(x, y, digits = 3, prefix = , cex.cor,axis=F, ...)
{
  tt-cbind(x,y)
  idx-apply(tt,1,function(x){sum(is.na(x))==0})
  x-x[idx]
  y-y[idx]
  usr - par(usr); on.exit(par(usr))
  par(usr = c(0, 1, 0, 1))
  r - abs(cor(x, y))
  print(r)
  txt - format(c(r, 0.123456789), digits = digits)[1]
  txt - paste0(prefix, txt)
  if(missing(cex.cor)) cex.cor - 0.8/strwidth(txt)
  text(0.5, 0.5, txt, cex = r^20*cex.cor)
}


-- 
Witold Eryk Wolski

__
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] igraph vertex.label.font sans serif

2013-08-20 Thread Witold E Wolski
Would like to plot vertex labels without serif.
there is vertex.label.font param but he lets me choose only between
one font type in normal bold and emph.

any suggestions welcome.


-- 
Witold Eryk Wolski

__
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] igraph vertex.label.font sans serif

2013-08-20 Thread Witold E Wolski
recall. it's:

vertex.label.family

sorry

On 20 August 2013 17:30, Witold E Wolski wewol...@gmail.com wrote:
 Would like to plot vertex labels without serif.
 there is vertex.label.font param but he lets me choose only between
 one font type in normal bold and emph.

 any suggestions welcome.


 --
 Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
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] parcor package example for adalasso.net fails.

2013-08-15 Thread Witold E Wolski
Hi,

I am a bit surprised that an example code from an R-package installed
from CRAN can fail:


 n-20
 p-10
 X-matrix(rnorm(n*p),ncol=p)
 pc-adalasso.net(X,k=5)
Performing local (adaptive) lasso regressions
Vertex no Error in glmnet(XXtrain, ytrain, type.gaussian = type,
standardize = FALSE) :
  x should be a matrix with 2 or more columns


regards

-- 
Witold Eryk Wolski

__
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] storing multidimensional arrays - save and load -

2013-08-14 Thread Witold E Wolski
I am have a procedure which generates multidimensional arrays.

To compute them is expensive so I want to store them in order to be
able to analyse them later.

I am using at the moment

problem is that the array is always assigned to a variable ma (the
computation is in a loop).
Than I generate a file name and store it (i.e)
save(ma, file=ma1.txt)
save(ma, file=ma2.txt)
...


problem starts when I want to load it
load(ma1.RData) # loads in ma
load(ma2.RData) # overrides ma

How can i prevent this behaviour. Is there a better way to store
multidimensional arrays?

regards


-- 
Witold Eryk Wolski

__
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] breaks argument in heatmap.2 doesn't do what it should I think

2013-08-06 Thread Witold E Wolski
I do set the breaks parameter in heatmap.2
I would expect that the color.key and the histogram (the thing in the
top left of the plot) are aligned.
Just that everyone can reproduce the problem:


mypalette-brewer.pal(11,RdYlBu)
ddd - rnorm(400,0,0.1)
mdd - matrix(ddd,ncol=50)
hm - heatmap.2(mdd,col=mypalette,scale=row) #this is used to
produce the breaks, (and here it works fine)

mdd - t(scale(t(mdd)))
heatmap.2(mdd,col=mypalette,scale=none,breaks=hm$breaks)

# take a look and you will see that the colors are not aligned with the breaks
although the documentation states
breaks: (optional) Either a numeric vector indicating the splitting
  points for binning ‘x’ into colors, or a integer number of
  break points to be used, in which case the break points will
  be spaced equally between ‘min(x)’ and ‘max(x)’.



-- 
Witold Eryk Wolski

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

2013-08-06 Thread Witold E Wolski
Does anyone also observes with R 3.1 (on linux) that the help.start
function frequently blocks the R session (never returns) ?
Can I do anything or just waith for R3.1.1?




-- 
Witold Eryk Wolski

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

2013-08-06 Thread Witold E Wolski
Dear Martin

I mean
R version 3.0.1 (2013-05-16) -- Good Sport

On 6 August 2013 16:55, Martin Maechler maech...@stat.math.ethz.ch wrote:
 Witold E Wolski wewol...@gmail.com
 on Tue, 6 Aug 2013 16:40:42 +0200 writes:

  Does anyone also observes with R 3.1 (on linux) that the help.start

 there's no R 3.1 .  What do you mean really?

 R 3.0.1 ?

 or do you mean the current R under development
 which (quite rarely) also shows as 3.1.0 and will be changed
 quite a bit before eventually be released as 3.1.0  in 2014 ??

 Witold, reallly, you should know better,
 I think 

  function frequently blocks the R session (never returns) ?
  Can I do anything or just waith for R3.1.1?

  --
  Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
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] When scale is applied in heatmap

2013-08-05 Thread Witold E Wolski
When clustering I would do something like

plot(hclust(dist(scale(X


In case of  heatmap and heatmap.2 it seems to me that for the dendrograms
plot(hclust(dist(X)))
is done
while for the heatmap
image(scale(X)) is done.

I would say this is a bug however, because this is consistent among
the heatmap functions, can anyone enlighten me why this is so?





-- 
Witold Eryk Wolski

__
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] heatmap scale parameter question

2013-08-01 Thread Witold E Wolski
I do not want to use the b word, but can anyone who also subscribes to
the r-developer list forward my observation regarding heatmap? I am
pretty confident that the behaviour of heatmap in R 3.0.1 is not that
one intended.




On 31 July 2013 14:03, Witold E Wolski wewol...@gmail.com wrote:
 Would anyone of the more experienced r-users explain to me the
 behaviour of the scale parameter in the heatmap function.

 different options for scale (R 3.0.1) do change only the colors but do
 not affect the dendrograms. Please see for yourself executing the
 following code:

 d - matrix(rnorm(100),nrow=20)
 stats::heatmap(d)
 X11()
 heatmap(d,scale=column)
 X11()
 heatmap(d,scale=row)
 X11()
 heatmap(d,scale=none)

 In all four above cases the dendrograms look exactly the same
 However, scaling clearly affects clustering. see:

 d - scale(d)
 heatmap(d,scale=none)


 best regards

 R version 3.0.1 (2013-05-16) -- Good Sport
 ciao

 --
 Witold Eryk Wolski


 --
 Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
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] heatmap scale parameter question

2013-07-31 Thread Witold E Wolski
Would anyone of the more experienced r-users explain to me the
behaviour of the scale parameter in the heatmap function.

different options for scale (R 3.0.1) do change only the colors but do
not affect the dendrograms. Please see for yourself executing the
following code:

d - matrix(rnorm(100),nrow=20)
stats::heatmap(d)
X11()
heatmap(d,scale=column)
X11()
heatmap(d,scale=row)
X11()
heatmap(d,scale=none)

In all four above cases the dendrograms look exactly the same
However, scaling clearly affects clustering. see:

d - scale(d)
heatmap(d,scale=none)


best regards

R version 3.0.1 (2013-05-16) -- Good Sport
ciao

--
Witold Eryk Wolski


-- 
Witold Eryk Wolski

__
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] heatmap scale parameter

2013-07-25 Thread Witold E Wolski
does change only the colors but dendrograms are unaffected.

d - matrix(rnorm(100),nrow=20)
heatmap(d)
heatmap(d,scale=column)
heatmap(d,scale=row)
heatmap(d,scale=none)


However scaling clearly affects clustering. see:

d - scale(d)
heatmap(d,scale=none)


R version 3.0.1 (2013-05-16) -- Good Sport
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

ciao

--
Witold Eryk Wolski

__
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] function 2 convert matrix to long-format?

2013-07-24 Thread Witold E Wolski
I would like to convert this (output of tapply)
, , minus

   B6  S9
T0 0.1416 0.12235
T1 0.1049 0.11890
T2 0.1328 0.15510

, , plus

B6  S9
T0 0.14225 0.16875
T1 0.09295 0.09900
T2 0.13350 0.14560

to long-format :

T0 B6 minus 0.1416
T0 S9 minus 0.12235
T0 B6 plus 0.14225
T0 S9 plus 0.16875

...


whats the default way in R?

best




--
Witold Eryk Wolski

__
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] function 2 convert matrix to long-format?

2013-07-24 Thread Witold E Wolski
RECALL : found the answer:
use aggregate instead of tapply

thx

On 24 July 2013 12:00, Witold E Wolski wewol...@gmail.com wrote:
 I would like to convert this (output of tapply)
 , , minus

B6  S9
 T0 0.1416 0.12235
 T1 0.1049 0.11890
 T2 0.1328 0.15510

 , , plus

 B6  S9
 T0 0.14225 0.16875
 T1 0.09295 0.09900
 T2 0.13350 0.14560

 to long-format :

 T0 B6 minus 0.1416
 T0 S9 minus 0.12235
 T0 B6 plus 0.14225
 T0 S9 plus 0.16875
 
 ...


 whats the default way in R?

 best




 --
 Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
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] anti off diagonal min max mean - how to rotate matrix by 90 degree

2013-07-17 Thread Witold E Wolski
How can id do this efficiently in R ?

1 0 0
0 2 0
0 0 3


rotate right
0 0 1
0 2 0
3 0 0
rotate left
0 0 3
0 2 0
1 0 0

What I want to do is described here:
http://stackoverflow.com/questions/13049575/r-min-max-and-mean-of-off-diagonal-elements-in-a-matrix

but I want do to it for all off-anti-diagonals.

I am also concerned that the method described on stackoverflow isn't
necessarily efficient.
I work with matrices of size 3k * 3k.


--
Witold Eryk Wolski

__
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] cut into groups of equal nr of elements...

2013-07-17 Thread Witold E Wolski
I would like to cut a vector into groups of equal nr of elements.
looking for a function on the lines of cut but where I can specify
the size of the groups instead of the nr of groups.




--
Witold Eryk Wolski

__
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] robust smoothing - median smoothing.

2013-07-17 Thread Witold E Wolski
Looking for robust smoothing methods available in R... a robust
version of lowess or smooth.spline.
Was searching for median and smoothing but the search engine isn't
calibrated .

--
Witold Eryk Wolski

__
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] file.stem?

2013-07-15 Thread Witold E Wolski
Looking for a function which returns the stem of the filename given a path.
i.e.
 file.stem(/the/path/to/afile.txt)
 afile

regards

-- 
Witold Eryk Wolski

[[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] file.stem?

2013-07-15 Thread Witold E Wolski
Rui, Thank you

On 15 July 2013 16:32, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 You can use ?basename to write a file.stem function:


 basename(/the/path/to/afile.txt)

 file.stem - function(x){
 bn - basename(x)
 gsub(\\..*$, , bn)
 }
 file.stem(/the/path/to/afile.txt)



 Hope this helps,

 Rui Barradas

 Em 15-07-2013 15:23, Witold E Wolski escreveu:

 Looking for a function which returns the stem of the filename given a
 path.
 i.e.

 file.stem(/the/path/to/afile.txt)
 afile


 regards





-- 
Witold Eryk Wolski

__
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] disabling vignette creation in R CMD build

2013-07-08 Thread Witold E Wolski
While developing a package I would like to disable vignette creation
when executing R CMD build. The vignette creation is costly so I would
prefer not to have to regenerate it every time.


regards

-- 
Witold Eryk Wolski

[[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] create index for tapply or by

2013-06-27 Thread Witold E Wolski
Is there a build in function to create an index for tapply or by given a
a numeric vector x an a vector of breaks?

What I want to do is:

x - 1:100
breaks - c(0,10,20,50,99,110)

y - rep(0,length(x))
for(i in 2:length(breaks)){
  y[which(xbreaks[i-1]  x = breaks[i])] - i
}

by(x,y,sum)

but I find the code especially th for loop unneRving.


-- 
Witold Eryk Wolski

[[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] write table without quotation marks in column names....

2013-05-30 Thread Witold E Wolski
Hi

write.table
likes to quote () the column and row names.

Is there a way to switch it off?

Witold

[[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] sweave xtable and driver RweaveHTML

2012-11-08 Thread Witold E Wolski
Hi,

So far I used Sweave to create pdf reports. I used xtable to create some
tables in the report.

But now I would like to use the same snw file to generate an HTML version.
The xtable output breaks the RweaveHTML driver.
library(R2HTML)
Sweave('analyseLFQ.Snw', driver = RweaveHTML)

Error in match.arg(options$results, c(Robj, html, hide)) :
  'arg' should be one of “Robj”, “html”, “hide”

Any suggestions would be highly recommended. I.e. I am wondering can I
include dynamically generated tables in Sweave output,
using syntax independent of the renderer?


regards
Witold




-- 
Witold Eryk Wolski

Triemlistrasse 155
8047 Zuerich

[[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] Sweave - if \Sexpr{} than \SweaveInput{my.Rnw}

2012-09-20 Thread Witold E Wolski
Depending on an R computation I would like to include an Sweave documents
in the main Sweave document.
How can I do it?

So I was thinking  to use Latex features :

\newif\ifpaper

\ifpaper

\SweaveInput{my1.Rnw}
\else
 \SweaveInput{my2.Rnw}
\fi

But how do I set paper to true or false given an \Sexpr ??

\papertrue % or

\paperfalse


Any ideas?


cheers


-- 
Witold Eryk Wolski

Triemlistrasse 155
8047 Zuerich

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