Displaying 20 results from an estimated 10000 matches similar to: "Visual Basic: calling compiled VB code from R"
2003 Aug 13
1
Problems with addition in big POSIX dates
Have you noticed any problems with big dates (>=1/1/2040) in R?
Here is the bit of code that I'm having trouble with:
> test.date <- strptime("1/1/2040",format="%m/%d/%Y")
>
> unlist(test.date)
sec min hour mday mon year wday yday isdst
0 0 0 1 0 140 0 0 0
>
> date.plus.one <- as.POSIXct(test.date) +
2017 Jan 03
2
[R] Problems when trying to install and load package "rzmq"
On Tue, Jan 3, 2017 at 3:53 PM, Whit Armstrong <armstrong.whit at gmail.com> wrote:
>
> I maintian the rzmq project.
>
> love to get it running on windows, but zmq doesn't play nicely with R's
> mingw.
It's fairly easy to link against the libraries from rwinlib:
https://github.com/rwinlib/zeromq. I'll send you a pull request later
this week to fix the binary
2004 Sep 09
4
scoping rules
Can someone help me with this simple example?
sq <- function() {
y <- x^2
y
}
myfunc <- function() {
x <- 10
sq()
}
myfunc()
executing the above in R yields:
> myfunc()
Error in sq() : Object "x" not found
I understand that R's scoping rules cause it to look for "x" in the
environment in which "sq" was defined (the global environment in
2004 Oct 25
1
copyright issues when package maintainer changes
I will be taking over as maintainer of the its package from Giles Heywood.
The code was originally written while he was working at Commerzbank. I have
added the header below to the top of the R source file to indicate the
changes in the copyrights for the code. The package was originally released
under GPL2. I have no experience with copyright issues, and would
appreciate it if someone who does
2003 Sep 17
3
Building and loading a DLL on Windows NT
I am trying to build a simple dll with Rcmd SHLIB to link into R. The
results of the build are below. From my limited knowledge of building DLLs,
it looks like it worked (I didn't get any errors).
F:\R\dlls> Rcmd SHLIB add.C
making add.d from add.C
g++ -IC:/PROGRA~1/R/src/include -Wall -O2 -c add.C -o add.o
ar cr add.a *.o
ranlib add.a
g++ --shared -s -o add.dll add.def add.a
2003 Dec 31
2
Calling primitive functions from C code
Does anyone have an example of calling primitive or internal functions from
C code that they would share with me?
I am having trouble trying to figure out how to construct the proper
arguments to pass to "do_subset_dflt"
Here is the prototype:
SEXP do_subset_dflt(SEXP call, SEXP op, SEXP args, SEXP rho);
The R_FunTab from "names.c" gives some additional information on the
2003 Dec 31
2
Calling primitive functions from C code
Does anyone have an example of calling primitive or internal functions from
C code that they would share with me?
I am having trouble trying to figure out how to construct the proper
arguments to pass to "do_subset_dflt"
Here is the prototype:
SEXP do_subset_dflt(SEXP call, SEXP op, SEXP args, SEXP rho);
The R_FunTab from "names.c" gives some additional information on the
2008 Nov 18
2
anyone familiar with this error?
[whit at linuxsvr R.packages]$ sudo R CMD INSTALL portfolio.construction
* Installing to library '/usr/local/lib64/R/library'
* Installing *source* package 'portfolio.construction' ...
** R
** preparing package for lazy loading
Loading required package: fts
Loading required package: quadprog
Loading required package: Rexcelpoi
terminate called after throwing an instance of
2009 Mar 31
4
what is the preferred method to create a package local variable?
for the moment, I'm using:
.onAttach <- function(libname, pkgname) {
.bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah")
}
.onUnload <- function(libpath) {
dbDisconnect(.bbg.db.conn)
}
which results in a hidden global variable in the global environment.
I would prefer to make the assignment only in the package namespace.
2004 Aug 19
2
proposed change to [.POSIXct
R developers,
The "tzone" attribute is stripped from a POSIXct object when the subscript
command is called ("[.POISXct"). This results in dates being printed in the
locale specific format after a subscript operation is applied to a POSIXct
object which has cause several problems for me in the past.
Here is an example of this problem under R 1.9.1:
> x <-
2008 Dec 09
1
any suggestions to deal with 'Argument list too long' for a R CMD check?
Since, gcc was using upwards of 2gb of ram to compile my package, I
just split all the functions into individual files.
I guess I'm too clever for myself, because now I get hit with the
"Argument list too long" error.
Is there a way to deal with this aside from writing my own configure
script (which could possibly feed the gcc commands one by one).
-Whit
RHEL 5
[whit at
2012 May 17
2
test suites for packages
Can anyone share some opinions on test suites for R packages?
I'm looking at testthat and RUnit. Does anyone have strong opinions on
either of those.
Any additional packages I should consider?
Thanks,
Whit
2006 Jul 27
3
deparse(substitute(foo))
I see that plot.default uses deparse(substitute(x)) to extract the
character name of an argument and put it on the vertical axis.
Hence:
foo <- 1:10
plot( foo )
will put the label "foo" on the vertical axis.
However, for a function that takes a "..." list as an input, I can only
extract the first argument name:
x <- 1:10
y <- 10:20
foo <- function(...) {
2008 Dec 11
2
is there a way to recursilvely lapply
for a simple example:
x <- list()
x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5))
x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11))
lapply(x,sum)
this fails w/
Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument
Just wondering if I have overlooked something obvious.
one can also do:
lapply(x,lapply,sum)
but that assumes that you already know how many levels
2008 Oct 28
2
color individual bar of histogram?
Anyone know a quick way to color one bar of a histogram?
I want to mark the bar in which the most recent observation falls.
So, for instance:
x <- rnorm(100)
latest.ob <- x[100]
hist(x)
## how do I mark the bucket that latest.ob falls into?
Thanks,
Whit
2006 Jul 26
2
RODBC on linux
Anyone out there using Linux RODBC and unixODBC to connect to a
Microsoft SQL server?
If possible can someone post a sample .odbc.ini file?
I saw a few discussions on the archives a few years ago, but no config
file details were available.
Thanks,
Whit
This e-mail message is intended only for the named recipient(s) above. It may contain confidential information. If you are not the intended
2002 Feb 22
1
Weekdays
Hello,
I'm trying to write a function that returns the number of weekdays between a
vector of start dates and a vector of end dates.
Subtracting the 2 times the number of whole weeks is the easy part and works
if the number of days is a multiple of 7.
However, the number of weekend days in the tail is a little harder. It
depends on both the start date of the tail and the number of days in
2005 Mar 02
2
apply a function to a rolling subset of a vector
Try this:
> ?convolve
> x<-rnorm(1000)
> y<-rep(1,20)
> z<-convolve(x,y,type="filter")
> plot(x,type="l")
> str(z)
num [1:981] 6.31 7.28 8.16 7.39 4.65 ...
> lines(c(rep(0,10),z,rep(0,10)),col="yellow",lwd=3)
> lines(c(rep(0,10),z,rep(0,10))/length(y),col="red",lwd=3) #running mean
You wrote:
Does anyone know an easy way
2008 Oct 29
1
builtin to filter a list?
I know it's easy to write a simple loop to do this, but in the spirit
of lapply, I thought I would ask if there is a builtin to filter or
take a subset of a list based on a predicate in a similar way to the
Erlang lists:filter/2 function:
http://www.erlang.org/doc/man/lists.html#filter-2
filter(Pred, List1) -> List2
Types:
Pred = fun(Elem) -> bool()
Elem = term()
List1 = List2 =
2009 Mar 17
1
question on "row.names" attribute of dataframe when called from a compiled package
Why does the following show a class attribute of "character" when
using the interpreter:
x <- data.frame(hat=1:10)
class(rownames(x)) ## returns [1] "character"
but when called from c/cpp, the rownames attribute has no class
attribute, and is in fact a vector of INTSXP?
> .Call("print_class_of_rownames", x, package = "test")
length(x): 10