Displaying 20 results from an estimated 10000 matches similar to: "Strange behaviour of the ':' operator"
2016 Sep 09
3
Different results for tan(pi/2) and tanpi(1/2)
The same argument would hold for tan(pi/2).
I don't say the result 'NaN' is wrong,
but I thought,
tan(pi*x) and tanpi(x) should give the same result.
Hans Werner
On Fri, Sep 9, 2016 at 8:44 PM, William Dunlap <wdunlap at tibco.com> wrote:
> It should be the case that tan(pi*x) != tanpi(x) in many cases - that is why
> it was added. The limits from below and below of the
2016 Sep 09
3
Different results for tan(pi/2) and tanpi(1/2)
As the subject line says, we get different results for tan(pi/2) and
tanpi(1/2), though this should not be the case:
> tan(pi/2)
[1] 1.633124e+16
> tanpi(1/2)
[1] NaN
Warning message:
In tanpi(1/2) : NaNs produced
By redefining tanpi with sinpi and cospi, we can get closer:
> tanpi <- function(x) sinpi(x) / cospi(x)
> tanpi(c(0, 1/2, 1, 3/2, 2))
2008 Apr 01
2
Applying rbind() to a sequence of data frame names
I have a set of data frames ds1, ds2, ... each having the same columns
and column names:
ds1 <- data.frame(x=c(1,2,3,4), y=c(5,6,7,8))
ds1 <- data.frame(x=c(9,10,11,12), y=c(13,14,15,16))
...
and I would like to combine them into just one data frame like
ds <- rbind(ds1, ds2, ...)
Because there are so many of them, I will have to use a character array
nms <-
2008 Nov 28
7
Examples of advanced data visualization
Dear R-help,
I am looking for ideas and presentations of new and advanced data visualization
methods. As an example of what I am searching for, the 'Many Eyes' pages at
http://manyeyes.alphaworks.ibm.com/manyeyes/
may provide a good paradigm. I would be interested even if it will not be easy
to implement such examples in R, e.g. because of the interactive nature of these
graphical
2009 Jul 07
3
r-project.org address blacklisted by anti-spam software
Dear List:
An e-mail mentioning the r-project.org address and sent to a friend at a German
university was considered spam by the local spam filter.
Its reasoning: the URL "r-project.org" is blacklisted at uribl.swinog.ch resp.
at antispam.imp.ch. I checked the list
http://antispam.imp.ch/swinog-uri-rbl.txt [caution: long list]
and indeed, there it was. Can anybody explain how or
2008 Sep 19
3
How to do knn regression?
Hello,
I want to do regression or missing value imputation by knn. I searched
r-help mailing list. This question was asked in 2005. ksmooth and loess
were recommended. But my case is different. I have many predictors (p>20)
and I really want try knn with a given k. ksmooth and loess use band width to define
neighborhood size. This contrasts to knn's variable band width via fixing
a
2010 Mar 21
2
Find a rectangle of maximal area
For an application in image processing -- using R for statistical purposes -- I
need to solve the following task:
Given n (e.g. n = 100 or 200) points in the unit square, more or less randomly
distributed. Find a rectangle of maximal area within the square that does not
contain any of these points in its interior.
If a, b are height and width of the rectangel, other constraints may have to be
2008 Aug 19
1
nonlinear constrained optimization
Hi. I need some advises on how to use R to find pi (i is the index) with
the following objective function and constraint:
max (sum i)[ f(ai, bi, pi) * g(ci, di, pi) * Di ]
s.t. (sum i)[ f(ai, bi, pi) * Di * pi] / (sum i)[ f(ai, bi, pi) * Di ] <=
constant
f and g are diffentiable.
So, I am thinking of optim with method = "BFGS"? But wonder how to include
the
2008 Mar 27
1
R Code and the Pygments Python SyntaxHighlighter
Dear R Help,
is someone going to write a R/S language lexer for the Pygments Python syntax
highlighter <http://pygments.org/>? As it is used now by Trac, Django, or the
Python documentation tool Sphinx, the R community can apply it in Python-based
Wikis like Moinmoin and others.
Hans Werner
2007 Nov 13
1
Discrimination of almost-random time series
Dear time-series specialist:
I've got some time series representing measurements from a physical
process, like atomic decay data. These time series look almost
random, but should hopefully be distinguishable as they were taken
under different conditions.
I am looking for statistical approaches that are sensitive enough to
discriminate between such series of measurements. Preferably, there
2009 Feb 17
3
Subset Regression Package
Dear all ,
Is there any subset regression (subset selection
regression) package in R other than "leaps"?
Thanks and regards
Alex
[[alternative HTML version deleted]]
2008 May 10
2
Hashes as S4 Classes, or: How to separate environments
For learning purposes mainly I attempted to implement hashes/maps/dictionaries
(Python lingua) as S4 classes, see the coding below. I came across some rough S4
edges, but in the end it worked (for one dictionary).
When testing ones sees that the dictionaries D1 and D2 share their environments
D1 at hash and D2 at hash, though I thought a new and empty environment would be
generated each time
2011 Nov 22
5
x, y for point of intersection
Hi everyone,
?
I am trying to get a point of intersection between a
polyline and a straight line ?.. and get the x and y coordinates of this point.
For exemplification consider this:
?
?
set.seed(123)
?
k1 <-rnorm(100, mean=1.77, sd=3.33)
?k1 <- sort(k1)
q1 <- rnorm(100, mean=2.37, sd=0.74)
q1 <- sort(q1, decreasing = TRUE)
plot(k1, q1, xlim <- c((min(k1)-5),
2023 Aug 13
4
Noisy objective functions
While working on 'random walk' applications, I got interested in
optimizing noisy objective functions. As an (artificial) example, the
following is the Rosenbrock function, where Gaussian noise of standard
deviation `sd = 0.01` is added to the function value.
fn <- function(x)
(1+rnorm(1, sd=0.01)) * adagio::fnRosenbrock(x)
To smooth out the noise, define another
2020 Sep 23
3
jitter-bug? problematic behaviour of the jitter function
Dear all,
i have noticed some strange behaviour in the ?jitter? function in R.
On the help page for jitter it is stated that
"The result, say r, is r <- x + runif(n, -a, a) where n <- length(x) and a is the amount argument (if specified).?
and
"If amount is NULL (default), we set a <- factor * d/5 where d is the smallest difference between adjacent unique (apart from fuzz) x
2020 Sep 23
3
jitter-bug? problematic behaviour of the jitter function
Dear all,
i have noticed some strange behaviour in the ?jitter? function in R.
On the help page for jitter it is stated that
"The result, say r, is r <- x + runif(n, -a, a) where n <- length(x) and a is the amount argument (if specified).?
and
"If amount is NULL (default), we set a <- factor * d/5 where d is the smallest difference between adjacent unique (apart from fuzz) x
2010 Sep 21
3
bivariate vector numerical integration with infinite range
Dear list,
I'm seeking some advice regarding a particular numerical integration I
wish to perform.
The integrand f takes two real arguments x and y and returns a vector
of constant length N. The range of integration is [0, infty) for x and
[a,b] (finite) for y. Since the integrand has values in R^N I did not
find a built-in function to perform numerical quadrature, so I wrote
my own after
2008 Dec 11
3
getting ISO week
Hi all,
Is there a simple function already implemented for getting the ISO
weeks of a Date object?
I couldn't find one, and so wrote my own function to do it, but would
appreciate a pointer to the "default" way. If a function is not yet
implemented, could the code below be of interest to submit to CRAN?
Best Regards,
Gustaf
--------------------
2008 Jul 08
4
Histogram with colors according to factor
Given a data frame with a continuous variable and a factor. I would like to
generate a histogram of the continuous variable, where each bar is filled
with different colors according to the percentage of factor values falling
into this region of the continuous variable.
I looked into packages like 'lattice' and 'ggplot2'. Searching R-help
revealed that 'histogram' is
2016 Sep 09
0
Different results for tan(pi/2) and tanpi(1/2)
If pi were stored and computed to infinite precision then yes we would
expect tan(pi/2) to be NaN, but computers in general and R
specifically don't store to infinite precision (some packages allow
arbitrary (but still finite) precision) and irrational numbers cannot
be stored exactly. So you take the value of the built in variable pi,
which is close to the theoretical value, but not exactly