Displaying 20 results from an estimated 3000 matches similar to: "running R commands asynchronously"
2007 Jul 05
0
RANDR1.2 and LVDS
Hi!
I've written a small amount of code that gets the randr 1.2 branch much
closer to working for me on a laptop. Most of the changes are fairly
obvious, but a couple of comments:
1) The changes to nv_crtc.c are clearly bogus, but I'm not sure what on
earth these registers do. I need to set them to get a moderately
sane-looking picture
2) The fp registers poked in nv_output.c
2007 Oct 09
3
How to create something between a script and a package
(Before starting: I'm a total R noob so please bear with me in case of
any error or faux pas).
Hi,
For a small project, I'm writing a few simple R functions and calling
them from python (using RPy). I'm sharing the code with a couple of
friends, using a subversion server.
Now, I want something like a package, to be able to share functions
between ourselves. Having read a few package
2009 Oct 26
2
R CMD check: Error in .C
Function/file names are hypothetical. Say I have written myfunction.R,
which calls myfunction.c via .C("myfunction", ...).
I've compiled successfully myfunction.c via R CMD SHLIB myfunction.c
in the terminal. Then, in the R console:
dyn.load("myfunction.so")
source("myfunction.R")
test <- myfunction() # works fine
So everything is in order, myfunction works
2007 Apr 03
3
Referencing function name from within function
Hello,
For verbose coding I'd like to do something like:
> myfunction <- function(x){
> if (a){
> stop(paste(myfunction_name_here,"requires xyz!")
> }
Is that possible?
Thanks for any hints, Joh
2006 Jun 28
2
hopefully my last question on lapply
Marc and many other people ( whose names escape me ) have been
very helpful in explaining the use of lapply to me.
In his last response, Marc explained that if tradevectors is a list
of vectors of different lengths ( excuse my terminology ) then
lapply(tradevectors,function(x) G[x]*B[x] )
will go through each component of the list as if it was a vector
and apply the element by element
2012 Mar 13
2
beginner's loop issue
Dear All,
I hope you don't mind helping me with this small issue. I haven't been using
R in years and I'm trying to fill in a matrix
with the output of a function (I'm probably using the Matlab logic here and
it's not working).
Here is my code:
for (i in 1:length(input)){
out[i,1:3] <- MyFunction(input[i,1],input[i,2], input[i,3])
out[i,4:6] <-
2006 May 16
3
multiple plots in a function()
Dear all,
I have the following problem:
I have written a function genereating to plots, eg
myfunction <- (data, some.parameters) {
#some calculations etc
.
par (mfrow=c(1,2))
plot1(......)
plot2(.....)
}
which works fine. But for analysing several variants, I tried a slope, eg:
par (mfrow=c(5,5))
for ( i in 1:10) {
myfunction(data, i)
}
Off
2009 Jun 03
1
Using constrOptim() function
I have a function myFunction(beta,x) where beta is a vector of coefficients
and x is a data frame (think of it as a matrix). I want to optimize the
function myFunction() by ONLY changing beta, i.e. x stays constant, with 4
constraints. I have the following code (with a separate source file for the
function):
rm(list=ls())
source('mySourceFile')
2018 Aug 09
3
WishList: Remove Generic Arguments
I apologize if this issue has been raised before.
I really like object oriented S3 programming.
However, there's one feature of object oriented S3 programming that I don't
like.
Generic functions can have arguments other than dots.
Lets say you have an R package with something like:
print.myfunction (f, ...)
{ dosomething (f, ...)
}
Noting that I use function objects a lot.
R CMD
2012 Nov 23
1
Adding a function with default parameters into the Rcmdr menu
Hi everyone,
I made some tests with Rcmdr, to add a function with default parameters :
For example (very simple):
myfunction<-function(var="314"){
print("hello")
print(var)
}
if I run myfunction() directly i see :
> myfunction()
[1] "hello"
[1] "314"
it's ok.
But if i edit de Rcmdr-menu.txt (in
2005 Oct 08
4
Warning: condition has length > 1
Hi -
I was wondering if anyone came across a problem such as mine! I was trying
to create a user-defined function, however, the results from calling the
function are unexpected!
When passing X parameter as a single value variable (x<-c(3)), everything
works fine. However, when passing a parameter as a vector with multiple
values (as the case in my code), the 'if condition' is only
2008 Dec 17
4
passing arguments to subset from a function
Hello R-helpers,
I'm writing a long function in which I manipulate a certain number of datasets. I want the arguments of said function to allow me to adapt the way I do this. Among other things, I want my function to have an argument which I will pass on to subset() somewhere inside my function. Here is a quick and simplified example with the iris dataset.
myfunction<-function(table,
2004 Oct 16
7
sapply and loop
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and
define some function on this matrix to get a 6 dimension vector as my
results.
As the loop should be slow, I generate 200 matrice first, and save them into
a list named ma,
then I define zz<-sapply(ma, myfunction)
To my surprise, It almost costs me the same time to get my results if I
directly use a loop
2004 Oct 16
7
sapply and loop
Dear all,
I am doing 200 times simulation. For each time, I generate a matrix and
define some function on this matrix to get a 6 dimension vector as my
results.
As the loop should be slow, I generate 200 matrice first, and save them into
a list named ma,
then I define zz<-sapply(ma, myfunction)
To my surprise, It almost costs me the same time to get my results if I
directly use a loop
2018 Mar 28
7
[RFC] Generate Debug Information for Labels in Function
Hello all,
I would like to enhance LLVM debug info that supports setting
breakpoint on labels in function.
Generally, if users use GDB as their debugger, they could set
breakpoints on labels in function. Following is an example.
// C program
static int
myfunction (int arg)
{
int i, j, r;
j = 0; /* myfunction location */
r = arg;
top:
++j; /* top location */
if (j == 10)
goto
2011 Oct 28
3
program never enters browser mode when I add browser()
Dear All
I have a program that breaks at the following lines of code:
bigfunction =
{
...
object1 = myfunction(x)
object2 = strsplit(object1, ",")[[1]]
...
}
where myfunction is defined elsewhere outside of bigfunction.
The error I get is "error in strsplit() -- object1 not found".
However, when I insert browser() into my code so that the above reads,
bigfunction =
{
2007 Jul 06
2
access to 'formula' terms in a user function
This is probably buried somewhere in the R help archives, but I've been
unable to find it, so perhaps the keywords I use here will help bring the
topic to the surface more easily for future users.
I want to write my own modeling function (ultimately for some
multidimensional windowing - but this question is on scripting basics). For
purposes of figuring out my needs, lets just consider
2011 Nov 21
3
How do I query "..." in a function call?
This is probably a very noobish question, but if I want to create a
function that allows an undetermined number of, say, numeric vectors to be
fed to it, I would use:
myfunction = function(...)
{
# Do something
}
Right? If so, how do I a) count the number of vectors "fed" to the
function, and b) how do I treat those vectors as variables, e.g. for the
call:
2012 Jan 03
6
calculate quantiles of a custom function
Hi,
I guess that my problem has an obvious answer, but I have not been able to
find it.
Suppose I create a custom function, consisting of two beta-distributions:
myfunction <- function(x) {
dbeta(x,2,6) + dbeta(x,6,2)
}
How can I calculate the quantiles of myfunction?
I have not seen any continous function treated in the docs, and applying the
"quantile function" gives me an
2005 Jul 19
2
Obtaining argument name within a function
Dear all
How can I obtain the name of the argument passed in a function? Here is a
simplistic example of what I would like to obtain:
myfunction= function(name) {
print(paste("The parameter name was",unknownFunction(name))
}
myfunction(myobject)
[1] "The parameter name was myobject"
Thanks
Francisco