Displaying 20 results from an estimated 2000 matches similar to: "Using variables from different environments in one function"
2013 Jun 12
2
Functions within functions - environments
Dear list,
I have a problem with nested functions and I don't manage to get it
solved. I know I should be looking in environments, and I have tried a
lot, but it keeps on erroring.
An easy version of the problem is as follows:
innerfunction<-function()
{
print(paste(a, " from inner function"))
print(paste(b, " from inner function"))
setwd(wd)
}
2012 Jul 30
6
Convert variable to STring
Dear all,
I have a variable that I would like also to use it as a string. The reasons is that I want to collect results from different function to one table.. So when I use the
colnames(mymatrix) <-c(function1.function2,function3)
the function1, function2, function3 to be "converted" to simple strings so as
colnames(mymatrix)
2012 Feb 09
3
calling the function which is stored in a list
Hi
I'm storing two functions in a list
# creating two function
function1 <- function(n) {
return(sum(n))
}
function2 <- function(n) {
return(mean(n))
}
#storing the function
function3 =c(function1,function2)
is it possible to call the stored function and used it ?
x=c(10,29)
funtion3[1](x)
Thanks
-----
Thanks in Advance
Arun
--
View this message in context:
2011 Nov 24
0
loop through columns in S4 objects
Dear experts,
I am trying to perform an association using snpStats.
I have a snp matrix called 'plink' which contains my genotype data (as
a list of $genotypes, $map, $fam), and a phenotype data frame which
contains the outcomes (outcome1, outcome2,...) I would like to
associate with the genotype.
My question is, how do I loop through the outcomes? This type of data
seems different from
2008 Apr 22
2
optimization setup
Hi, here comes my problem, say I have the following functions (example case)
#------------------------------------------------------------
function1 <- function (x, theta)
{a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] )
b <- x * theta[1] / theta[3]^2
return( list( a = a, b = b )) }
#-----------------------------------------------------------
function2<-function (x, theta)
{P
2009 Dec 22
1
[LLVMdev] is there a compiler barrier that is effective at codegen level?
Hi,
I would like to prevent that two adjacent calls to external functions getting
interleaved/separated by other neighboring code. This mixing seems to happen
in the code generator. I can prevent it by putting the two calls into a
separate BB, but then I can't use -simplifycfg, -jump-threading, ... as is.
Here is an example:
%160 = add i64 %158, %159 ; <i64>
2006 Oct 09
0
dispatch on functions (was: Re: ifelse(logical, function1, function2) does not work)
On 10/7/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> I have noticed that dispatch on functions seems not to work
> in another case too. We define + on functions (I have ignored
> the niceties of sorting out the environments as we don't really
> need it for this example) but when we try to use it, it fails even
> though in the second example if we run it
2006 Oct 07
3
ifelse(logical, function1, function2) does not work
Why this kind of assignment does not work?
n <- 1
f <- ifelse(n == 1, sin, cos)
f(pi)
this must be rewritten as:
n <- 1
f <- cos
if (n == 1) f <- sin
f(pi)
[oops. 1.224606e-16 instead of zero. Damn floating point errors :-/]
Alberto Monteiro
2014 Jun 11
3
[LLVMdev] How do clang & clang++ choose function names for LLVM IR?
Hello all,
I'm getting started on a project using LLVM's opt tool to do static
analysis, printing call graphs and such. When compiling C programs to IR
(and eventually to call graphs), function names remain the same (main,
function1, function2 etc.), but when compiling the same program as C++, the
function names often have cruft added to them (_Z9function1v, _Z9function2v
etc.) which
2009 Dec 03
2
Error in namespaceExport(ns, exports) :
Dear all,
I get the error
"Error in namespaceExport(ns, exports) :
undefined exports function1 , function2"
when compiling or even when I roxygen my package. The two function I once
had in my package but I deleted them including their .Rd files. I also can't
find them in any other function or help file.
So does anybody know where these functions are still listed that causes
2009 Dec 03
2
Error in namespaceExport(ns, exports) :
Dear all,
I get the error
"Error in namespaceExport(ns, exports) :
undefined exports function1 , function2"
when compiling or even when I roxygen my package. The two function I once
had in my package but I deleted them including their .Rd files. I also can't
find them in any other function or help file.
So does anybody know where these functions are still listed that causes
2008 Feb 20
1
Problem Using the %in% command
Hello all!
I have the following problem with the %in% command:
1) I have a data frame that consists of functions (rows) and genes
(columns). The whole has been loaded with the "read.delim" command
because of gene-duplications between the different rows.
2) Now, there is another data frame that contains all the genes (only
the genes and without duplicates) from all the functions of
2007 Jul 31
1
Getting variable name used in function...
Dear Users,
I am using functions for calculations in my study. I have two functions and one is calling the other two times one after another. But the called function deals with two different data object (matrix, data frame, etc.), so I could not make the second function output data object-free (for example, Ý would like to write csv files but could not give different file names) and I would
2004 Apr 27
1
'R CMD build' fails when there are spaces in the path (PR#6830)
Full_Name: Byron Ellis
Version: R 1.9.0 (and 2.0.0)
OS: Linux (Redhat Fedora Core)
Submission from: (NULL) (140.247.241.197)
It appears that `R CMD build` cannot handle spaces in the path when building
packages for distribution. For instance:
[ellis@net-78815 ~/Bayesian Networks]$ R CMD build bnsl
* checking for file 'bnsl/DESCRIPTION' ... OK
* preparing 'bnsl':
* cleaning src
*
2023 Dec 30
2
Help request: Parsing docx files for key words and appending to a spreadsheet
Hi Eric
Thanks for that. That seems to fix one problem (the lack of a
separator), but introduces a new one when I complete the function Calum
proposed:Error in docx_summary() : argument "x" is missing, with no default
The whole code so far looks like this:
# Load libraries
library(tcltk)
library(tidyverse)
library(officer)
filepath <- setwd(tk_choose.dir())
filename <-
2007 Jun 29
1
R CMD build with mingw and msys (PR#9766)
Full_Name: Steffen
Version: 2-5-0
OS: Windows
Submission from: (NULL) (192.124.243.162)
Hi,
the R CMD build script is using
if($WINDOWS) {
## workaround for paths in Cygwin tar
$filepath =~ s+^([A-Za-z]):+/cygdrive/\1+;
}
which does not work if the build environment is a MINGW.
I have added the patch below,
Yours,
Steffen
$ diff -u build build.orig
--- build
2020 Oct 29
2
Something is wrong with the unserialize function
Hi all,
I am not able to export an ALTREP object when `gctorture` is on in the
worker. The package simplemmap can be used to reproduce the problem. See
the example below
```
## Create a temporary file
filePath <- tempfile()
con <- file(filePath, "wrb")
writeBin(rep(0.0,10),con)
close(con)
library(simplemmap)
library(parallel)
cl <- makeCluster(1)
x <- mmap(filePath,
2016 Sep 03
19
[Bug 97588] New: Disconnecting/Reconnecting monitor results in 'laggy' graphics and disappearing mouse cursor
https://bugs.freedesktop.org/show_bug.cgi?id=97588
Bug ID: 97588
Summary: Disconnecting/Reconnecting monitor results in 'laggy'
graphics and disappearing mouse cursor
Product: xorg
Version: unspecified
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
2010 May 21
2
Problem creating shortcut
Hi everyone!
I'm a recent linux user starting my first steps with this powerfull OS, and so far I've been able to make my way through installing and configuring a basic box connected to a M$ network.
Now I'm trying to create a shortcut to run my windows database application in wine but so far I had no success...
To correctly start my application in M$ windows I need to create a
2001 Apr 18
4
squelch-1.0beta12 released
<ad>
.q.u.e.l.c.h is an audio player dedicated to Ogg Vorbis.
This is a bugfix release.
RPMs available for i386, i486, i586, i686 and Athlon.
Source available as tar.gz, tar.bz2 and src.rpm.
http://www.geoid.clara.net/rik/squelch.html
Tested on Linux, may work elsewhere. Requires only
Vorbis, libao and Qt (compiled with thread support.)
</ad>
Have fun ;)
Rik
--- >8 ----