Displaying 20 results from an estimated 2000 matches similar to: "A Maze Generator"
2017 Nov 03
0
repeat a function
Hi
Well, I am not an expert in this field so I cannot comment your approach. I wanted only to point out that building matrix your way is like scratching your left ear with right hand, especially in R. What if you want increase size of your matrix?
E.g. you use function ProbUP once for row "0" and than for rows different from jmax (if I correctly understand your code). Use of any
2017 Nov 02
2
repeat a function
Hi Petr,
Many thanks for your response.
Basically I want to create a probability matrix to be used in a trinomial tree going forward. This is the reason why I thought to build the matrix around 0 would be much more efficient. I need to loop through because the probabilities will depend on my node and is not always the same per row (e.g. if N> jmax, jmax being defined in another function)
I
2017 Nov 01
3
repeat a function
I want to populate the matrix prb through the function HWMProb <- function (a,j,dt) that encapsulates different functions (please see code below), using j= 0:2 for each j.
It only populates prb if I specify each function independently in the global environment and then run the loop with the iF statement, as per below.
for (j in 0:2) {
if (j==0) {
prb["0","1"] <-
2017 Nov 02
0
repeat a function
Hi Eric
I did not see any answer and frankly speaking I cannot provide you with canned help.
AFAIK if a function is defined within another function (which is your case) it cannot be called directly so it is necessary to define it in global environment.
> fff <- function(x) {
+ myf <- function(a) a+2
+ myf(x)^2}
>
> fff(5)
[1] 49
> myf(5)
Error in myf(5) : could not find
2005 Jan 12
2
?"=" (Windows) (PR#7504)
?"=", ?"==", ?"!=", ?">=", and ?"<=" sends me to the documentation for
?help on Windows, while returning the correct documentation on Linux.
Robert
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor
2006 Nov 29
1
Removing terms from formula
R-help,
Given a simple linear model, say lm(x ~ y + z), I would like to remove
model terms that are factors with only one level. Thus, if 'z' were a
factor with only one level, lm(x ~ y + z) becomes lm(x ~ y + 1).
Likewise, if both 'y' and 'z' are one-level factors, then the resulting
calculation is simply lm(x ~ 1).
Unfortunately, I have not been able to come up with an
2008 Jul 29
3
sapply(Date, is.numeric)
FYI,
I've tried posting the below message twice to the bug tracking system,
once by email (below), and the second time 5 days later directly to the
bugs.r-project.org website. As far as I can tell, the bug tracking
system hasn't picked this up. Also it looks like the latest "incoming"
bug is dated 25 May 2008, so perhaps others are having difficulty as
well. (cc: r-bugs)
2006 May 22
3
Wishlist: Vignettes on CRAN
I was recently browsing through CRAN's Finance task view to remind
myself of the publicly available packages relevant to my work. As the
reference manuals are all online, I am able to flip through the
available functions to get an idea of the package's scope before
downloading.
That said, many authors have taken the time to additionally provide a
useful vignette which provides a better
2008 Apr 28
2
time zone conversion
Hello,
I'm trying to convert times in the EST/EDT (New York) format to times in
the GMT/BST (London) and UTC+9 format (Tokyo). That is, if I know what
time it is in New York, what is local time in London and Tokyo?
Ex:
Here's the conversion from New York EST/EDT time to London's GMT/BST
time zone for three days in 2007. Note that the US and London change to
daylight savings on
2005 Feb 28
2
Changing function arguments to NULL
I'm trying to build a recursive set of functions that take a set of
arguments, change some of the arguments and recursively call the same
(or different) function.
For example here's a stupid recursive counting function that prints back
all integers from x to 0 (and ignores arguments y and z)
cnt <- function(x, y, z) {
stopifnot(is.numeric(x))
print (x)
recursionFUN <-
2008 Jul 08
1
split.Date
Hello,
I wanted to suggest that the below method for split.Date be added to the
base library to significantly speed up splits with values of class Date.
In the below example I show a speed improvement of 175x for 1000 data
points. On a vector of size 1e6, the time difference was 22 minutes for
split.default versus 0.3 seconds for the split.Date function below (!).
Note that this improvement will
2006 Sep 29
1
Plotting text with lattice
Hello,
I've decided to take the leap and try my hand at the lattice package,
though I am getting stuck at what one might consider a trivial problem,
plotting text at a point in a graph. Apologies in advance if (that) I'm
missing something extremely basic.
Consider in base graphics:
> plot(1:10)
> text(2, 4, "Text")
In the above you will see text centered at the point (2,
2008 May 16
1
var/sd and NAs in R2.7.0
Hello all,
I just upgraded to R 2.7.0 and found that the behavior of 'var' and 'sd'
have changed in the presence NAs (this wasn't explicit in the NEWS file,
though I see it probably has to do with the change for cor/cov). Anyway,
I just want to make sure that it was intentional to produce an error
when there was all NAs and na.rm=TRUE, rather than returning an NA (like
R
2006 Oct 23
4
Changing function arguments
R-Developers,
I'm looking for some help computing on the R language.
I'm hoping to write a function that parses a language or expression
object and returns another expression with all instances of certain
argument of a given function altered. For instance, say I would like my
function, myFun to take an expression and whenever the argument 'x'
appears within the function FUN inside
2008 Sep 12
1
match and incomparables
Hello,
I was playing around with the newly implemented 'incomparables' argument
in 'match' and realized the argument does not behave anything like I
expected. Can someone explain what is going on here? Sorry if I'm
misreading the documentation.
> match(1:3, 1:3, incomparables=1)
[1] NA 2 3 # This seems right, the 1 in 'x' is 'incomparable'
>
2005 Jan 27
3
Indexing Lists and Partial Matching
I was unaware until recently that partial matching was used to index
data frames and lists. This is now causing a great deal of problems in
my code as I sometimes index a list without knowing what elements it
contains, expecting a NULL if the column does not exist. However, if
partial matching is used, sometimes R will return an object I do not
want. My question, is there an easy way of getting
2005 Jan 10
1
new("call") problem (PR#7490)
I have found a solution to the new("call") problem that I believe
produces the correct behavior for the default call object, and am also
reclassifying this as a bug, as I believe the current behavior to be
incorrect.
Recap, the following error occurs:
> new("call")
Error in print("<undef>"()) : couldn't find function "<undef>"
It looks
2006 Jan 12
1
.leap.seconds
I glanced at the .leap.seconds object and noticed that it has not been
updated for the most recent leap second that occurred 2005 December 31,
23h 59m 60s. See the IERS bulletin here:
http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat
Moreover, after a more careful glance at the .leap.seconds object, I
noticed that there are two incorrect entries. First, there was not a
leap second on 1986 June
2010 Jul 06
1
with(x, Recall()) Crash
R-devel,
I discovered a segfault in my R code that boiled down to my incorrect
use of the Recall() function embedded within a with() function. Since
segfaults are generally bad things, even when it's the user's fault for
writing nonsense code, I thought I'd pass along the offending code. I've
tested the crash on R 2.11.1 (on Linux and Mac), but not in devel
versions of R.
HTH,
2006 Sep 20
1
seq.Date not accepting NULL length.out (PR#9239)
There seems to be a bug in seq.Date such that it will not allow the user
to pass in length.out =3D NULL, despite the fact that this is the =
default
argument.
For example:
> dt1 <- as.Date("2004-12-31")
> dt2 <- as.Date("2005-12-31")
> seq.Date(dt1, dt2, length.out =3D NULL, by =3D "month")
Error in seq.Date(dt1, dt2, length.out =3D NULL, by =3D