Re: [R] Discrete simulated annealing

2013-05-28 Thread Enrico Schumann
# ... and change it x[change.what] <- sample(pp[[change.what]], 1) x } (x <- c(1,1,2)) ## a feasible initial solution ## [1] 1 1 2 (x <- neighbour(x)) ## [1] 2 1 2 (x <- neighbour(x)) ## [1] 2 9 2 (x <- neighbour(x)) ## [1] 2 9 17 If upper/lower bounds

Re: [R] Plot 2 different time series data with 2 y axes

2013-06-02 Thread Enrico Schumann
red","blue"),lty=1,legend=c(left_data_type, > right_data_type)) > grid (10,10, lty = 6, col = "cornsilk2") > } > > I would expect the plots to have different starting points for x values > but it seems its unable to understand the dates are different.

Re: [R] Sending Email with Attachment

2013-06-09 Thread Enrico Schumann
connection >>In addition: Warning message: >>In socketConnection(host = server, port = port, blocking = TRUE) : >> blu-m.hotmail.com:25 cannot be opened > > It's an unsurprising result since telnet doesn't connect either: > > telnet blu-m.hotmail.com 25 > T

Re: [R] alternative to ifelse

2013-06-19 Thread Enrico Schumann
1 and 0 when coerced to numeric: as.integer(apply(X, 1, function(x) any(x == 1L))) ## [1] 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 Regards, Enrico -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ R-help@r-pro

Re: [R] return output to console for copying as input

2013-06-25 Thread Enrico Schumann
> > the.function(X) >>"a","b","c" > > what is the function? > the.function <- function(x) cat(paste0("\"", x, "\"", collapse = ", "), "\n") -- Enrico Schumann Lucerne, Switzerland http

Re: [R] Time of day

2013-06-25 Thread Enrico Schumann
gt; hopefully other people have already done this, or there is a > straightforward representation of time of day in R that I have not been > able to find in the documentation. strftime(Sys.time(), "%H:%M") -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net ___

Re: [R] Getting a particular weekday for a given month

2014-04-07 Thread Enrico Schumann
t's available from here http://enricoschumann.net/R/packages/PMwR/index.htm If you are on a Unix-type system (or have Rtools installed on Windows), you can directly install the package from source: install.packages('PMwR', repos = 'http://enricoschumann.n

Re: [R] legendre quadrature

2014-05-01 Thread Enrico Schumann
0]] > chebyshev.c.quadrature(integrand, order.rule, lower = -1, upper = 1) > > Thank you > Diba > -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] Selecting individuals to maximize the correlation of two variables

2014-01-11 Thread Enrico Schumann
only...) http://enricoschumann.net/NMOF.htm#NMOFmanual -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ 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

Re: [R] Environmental problems.

2014-02-25 Thread Enrico Schumann
ceived. (I don't really grok environments. I just try > things until *something* works!) > > cheers, > > Rolf Turner > I did not follow your example, neither do I use the deSolve package; but why not pass an environment as an argument? ## some iterative function that tak

Re: [R] Yield to maturity in R

2013-10-31 Thread Enrico Schumann
On Wed, 30 Oct 2013, Katherine Gobin writes: > Dear R forum, > > Just want to know if there is any function / package in R which will > calculate Yield to Maturity in R for a given bond? > > Regards > > Katherine require("sos") findFn("yield to m

Re: [R] save table to txt file in a printable form

2013-11-19 Thread Enrico Schumann
> > Regards > Alex > [[alternative HTML version deleted]] Please send plain-text emails. -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] How can I find nonstandard or control characters in a large file?

2013-12-09 Thread Enrico Schumann
'non-standard characters' are. But perhaps ?tools:::showNonASCII, which uses ?iconv, can help you. (Please note the warnings and caveats on the functions' help pages.) -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __

Re: [R] Integrate to 1? (gauss.quad)

2010-11-16 Thread Enrico Schumann
gauss--hermite weights the function f(x) to be integrated by exp(-nodes^2), ie, it uses the 'trick' that exp(nodes^2) * exp(-nodes^2) = 1. so your sum should be exp(qq$nodes^2) * exp(-qq$nodes^2) * f(qq$nodes^2) = exp(qq$nodes^2) * qq$weights * f(qq$nodes). hence sum(exp(qq$nodes^2) * (1/(s*sqrt

Re: [R] Random Normal Variable Correlated to an Existing BinomialVariable

2011-04-27 Thread Enrico Schumann
Hi, do you know the parameters of the binomial variate? then maybe you could use something like the code below. as Petr pointed out, it is generally not guaranteed that you can create variates with any linear correlation (ie, depending on the parameters of the binomial) n <- 100# how many v

Re: [R] Generating uniformly distributed correlated data.

2011-02-20 Thread Enrico Schumann
maybe this helps http://comisef.wikidot.com/tutorial:correlateduniformvariates regards enrico > -Ursprüngliche Nachricht- > Von: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] Im Auftrag von Søren Faurby > Gesendet: Sonntag, 20. Februar 2011 03:18 > An: r-help@r-

Re: [R] RODBC excel - need to preserve (or extract) numeric column names

2011-04-05 Thread Enrico Schumann
At least for Excel 2003 on my computer (Win XP) I can "persuade" Excel to treat cells like text by prepending a ' to the entry (eg, '1000). Then sqlFetch/RODBC should import these cells as character. [But a number would not be valid column name for a data.frame, and you may run into other trouble.

Re: [R] Efficient way to Calculate the squared distances for a set ofvectors to a fixed vector

2011-08-23 Thread Enrico Schumann
You could do something like this: # data nrows <- 2L ncols <- 5L myVec <- array(rnorm(nrows * ncols), dim = c(nrows, ncols)) y <- rnorm(ncols) temp <- t(myVec) - y result <- colSums(temp * temp) # check all.equal(as.numeric(crossprod(myVec[1L, ] - y)), result[1L]) #... (And don't use a dat

Re: [R] Create two uniformly random variables correlated

2011-08-25 Thread Enrico Schumann
This topic has been discussed (quite recently) on R-help. http://r.789695.n4.nabble.com/Generating-uniformly-distributed-correlated-da ta-td3314905.html Enrico > -Ursprüngliche Nachricht- > Von: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] Im Auftrag von Soberon

Re: [R] R CMD build and vignettes

2011-09-21 Thread Enrico Schumann
EASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat.e

Re: [R] R CMD build and vignettes

2011-09-21 Thread Enrico Schumann
sting-guide.html<http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R

Re: [R] Variable scope in functions - best practices

2011-07-24 Thread Enrico Schumann
Hi Noah, you could assign your "global variables" into an environment. Then make it the environment of your function, and use the `<<-` operator (or 'assign'). An example: > myData <- new.env() > myData$i <- 0 > iPlusOne <- function() i <<- i+1 > environment(iPlusOne) <- myData > ls() [1] "iPlu

Re: [R] Correlated Multivariate Distribution Generator

2011-07-27 Thread Enrico Schumann
Hi Yue Yu, similar questions have been discussed several times on this list; you may want to search the archives. Do you mean linear correlation, or rank correlation? In general, a given linear correlation will not always be attainable (though in your case, it probably will). If _rank_ correlati

Re: [R] Correlated Multivariate Distribution Generator

2011-07-27 Thread Enrico Schumann
Just a pointer, not a solution: if you use the method I described, it all comes down to the initial correlation matrix that you specify for the Gaussian case. If you had the "correct" initial correlation matrix, it would lead to the desired linear correlation in your binomials. (But it is not guar

Re: [R] RQuantLib: SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'

2012-08-08 Thread Enrico Schumann
Am 08.08.2012 09:54, schrieb Cren: # Hi all, # trying to run the following example code # from 'RQuantLib' package... HullWhite <- list(term = 0.055, alpha = 0.03, sigma = 0.01, gridIntervals = 40) Price <- rep(as.double(100),24) Type <- rep(as.character("C"), 24) Date <- se

Re: [R] Changing line length in Sweave output works for numeric, but not for character vectors

2012-08-21 Thread Enrico Schumann
Hi Simon try strwrap(test) regards, Enrico Am 20.08.2012 23:03, schrieb Simon Kiss: Hi there: I'm preparing a report in RStudio 0.96.330 on a Mac OS. I'm running R 2.15.0 I understand from Ross Ihaka's document (http://www.stat.auckland.ac.nz/~stat782/downloads/Sweave-customisation.pdf) t

Re: [R] how to add "waiting for page change" to my script

2011-11-24 Thread Enrico Schumann
rect solution? � Jabez [[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,

Re: [R] generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})

2011-11-27 Thread Enrico Schumann
ecRec(1:1000, 0.5), matRec(1:1000, 0.5), matRec2(1:1000, 0.5), replications = 50, order = "relative") Thank you very much for your help. ______ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] Argument validation within functions

2011-12-06 Thread Enrico Schumann
x.net/de/go/freephone -- __ 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] For loop indicies

2011-12-12 Thread Enrico Schumann
d provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-

Re: [R] sum with dates

2011-12-12 Thread Enrico Schumann
the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http:/

Re: [R] Constrained Optimisation

2011-12-19 Thread Enrico Schumann
uide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

Re: [R] constructing yieldcurve

2012-01-07 Thread Enrico Schumann
cible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ 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, min

Re: [R] splitting strings effriciently

2012-01-08 Thread Enrico Schumann
blem. Does anyone have any thoughts? for(i in 1:4861469) { lst<-unlist(strsplit(data$ComputerName[i], "\\.")) data$IPA[i]<-lst[[1]] data$IPB[i]<-lst[[2]] data$IPC[i]<-lst[[3]] data$IPD[i]<-lst[[4]] r

Re: [R] RODBC vs gdata

2012-01-09 Thread Enrico Schumann
greeting Christof __ 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. -- En

Re: [R] RODBC vs gdata

2012-01-09 Thread Enrico Schumann
xt', numeric entries will be read as SQL nulls and hence R NAs. Unfortunately, in neither case does reformatting the column help." So I think I have to use "gdata" to be sure to read all datas. regards Christof Am 09-01-2012 19:29, schrieb Enrico Schumann: Hi Christof, have

Re: [R] suggestions argument in rbga function in genalg package

2011-09-22 Thread Enrico Schumann
p PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat

Re: [R] Create combinations of rows

2011-10-04 Thread Enrico Schumann
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA

Re: [R] Problem with pmax and matrix to calculate row maxima

2011-10-12 Thread Enrico Schumann
tinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list h

[R] [R-pkgs] NMOF 0.20-0 (Numerical methods and optimization in finance)

2011-10-25 Thread Enrico Schumann
Dear all, version 0.20-0 of package NMOF is now on CRAN. 'NMOF' stands for 'Numerical Methods and Optimization in Finance'. The package accompanies the book with the same name, written by Manfred Gilli, Dietmar Maringer and Enrico Schumann, published by Elsevier/Academic

Re: [R] plotting large time series

2011-10-28 Thread Enrico Schumann
=''),paper="a4r"). I would be very grateful for an answer __ 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.ht

Re: [R] element-by-element comparison

2011-10-30 Thread Enrico Schumann
ct.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] Portfolio Optimization

2012-01-13 Thread Enrico Schumann
, at least in a first round, be included through penalties. Regards, Enrico PS. There is a mailing list dedicated to finance-with-R questions, and you may get better answers there. https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Enrico Schumann Lucerne, Switzerland http://nmof

Re: [R] Control number of assets in resulting portfolio with optimizations using package fPortfolio

2012-02-16 Thread Enrico Schumann
ect.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. -- Enrico Schumann Lucerne, Switzerland http://n

Re: [R] Run function several times changing only one argument - without a loop

2012-02-20 Thread Enrico Schumann
d]] __ 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. -- Enrico Schumann Lucerne

Re: [R] Sorting strings

2012-02-20 Thread Enrico Schumann
ion with z abcz abz Petr Savicky. __ 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, reproduc

Re: [R] How to determine a subset of a binary strings?

2012-02-20 Thread Enrico Schumann
org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://nmof.net/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the po

Re: [R] subset daily to monthly in a zoo or xts

2012-04-23 Thread Enrico Schumann
d % of "NA" in each month. I am finding it difficult to subset the daily dataset into monthly for the given operation.I am planning to do this for a huge dataset. Thanks in advance. Regards Vikram -- Enrico Schumann Lucerne, Switzerland http://nmof.net ___

[R] [R-pkgs] PMwR 1.0 (Portfolio Management with R)

2024-10-21 Thread Enrico Schumann
rico [1] https://enricoschumann.net/R/packages/PMwR/manual/PMwR.html [2] https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3374195 -- Enrico Schumann Lucerne, Switzerland https://enricoschumann.net ___ R-packages mailing list r-packa...@r-project

[R] [R-pkgs] NMOF 2.10-0 (Numerical Methods and Optimization in Finance)

2024-10-21 Thread Enrico Schumann
Dear all, version 2.10-0 of package NMOF is on CRAN now. NMOF stands for 'Numerical Methods and Optimization in Finance', and it accompanies the book with the same name, written by Manfred Gilli, Dietmar Maringer and Enrico Schumann.[1] Since the last announcement on this list in 202

Re: [R] How to install this package

2024-10-01 Thread Enrico Schumann
on is still more than 10 years old. But for what it is worth, I can install this version on Ubuntu 24.04, with R 4.4.1. In case you need only specific functionality from the package, you might be able to extract those bits either from the archived tarball, or from the source code at https://r-forge.r-

Re: [R] Change data frame to time series data

2024-10-02 Thread Enrico Schumann
# 2014-01-01 00:02:003 But be sure to read about ?as.POSIXct; in particular, the handling of timezones/daylight-saving time. > [[alternative HTML version deleted]] Please send plain-text messages to this list; otherwise, the results become hard to read. -- Enrico Schumann Lucerne, Switzer

Re: [R] R CMD check error: File `inconsolata.sty' not found

2025-02-05 Thread Enrico Schumann
saving backups to /usr/local/texlive/2024/tlpkg/backups > tlmgr: no updates available What does kpsewhich inconsolata.sty (on the command line) say? (It should show the location of the file.) The 'Installation and Administration' manual briefly discusses how to

Re: [R] aggregate produces results in unexpected format

2024-12-11 Thread Enrico Schumann
## 2 20 25 22 4 ## 3 30 35 32 4 (Though the result is a numeric matrix. But that is only one 'as.data.frame' away from a data.frame, if it has to be one.) kind regards Enrico > John David Sorkin M.D., Ph.D. > Professor of Medicine, University of Maryla

Re: [R] [off-topic] crossword

2024-12-15 Thread Enrico Schumann
gt; On Fri, 13 Dec 2024, 04:26 Ebert,Timothy Aaron, >> > wrote: >> > >> > > I do not understand the question and I do not understand the answer. >> > > Possibly one confounds the other. >> > > >> > > -Original Message- >> >

Re: [R] How to generate mutiple set of samples in R?

2019-06-05 Thread Enrico Schumann via R-help
this guide and follow its advice. MT> and provide commented, minimal, self-contained, reproducible code. -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

<    1   2