Displaying 20 results from an estimated 1200 matches similar to: "Dummy quesion about environment"
2005 Nov 10
7
different functions on different vector subsets
Hi,
I am trying to apply two different functions on on a vector as follow:
a<-c(NA,1,2,3,-3,-4,-6)
if a>0 I would like to raise it by the power of 2: 2^a and if the a<0 I
would like to have the inverse value, i.e., -1/2^a.
so I thought of doing it two steps:
a[a>0]<-2^[a>0]
a[a<0]<-(-1)/2^a[a<0]
I got the following error
Error: NAs are not allowed in subscripted
2003 May 01
1
rotate plot
Dear group members,
I am trying to plot two adjacent plots using layout function. One plot is scatter plot and the other is density plot. However, I would like that the density plot would be present horizonaly in respect to the scatter plot.
| |
| |
| |
|
2003 Jun 16
1
grid background color
Dear all,
I am trying to run cloud function in lattice library under r-1.7, and I wlways get gray background. I've tried to chang it by set "...par.box=list(col="white")"
or by gpar(background="white") but no result.
How do i do it?
Thanks in advance,
Ron
2003 Jul 13
1
bootstrap for hclust
dear group members,
I am looking for a function that assess the stability of cluster. The result of hclust function is an hclust object which can be plot as a dendrogram. However to have confidence in the tree topology usualy bootstap is applied. I understand that I can apply bootstarp on the original data and then run hclust(dist() ) as much as I resampled but how to comapre the topologies the I
2003 Feb 08
1
mirroring R
Dear supporter,
Can you tell me please how can I mirroring R at our site? One of the reasons I would like to do this is the fact that it is impossible to update R behind our firewalls.
Thank in advance
Ron Ophir, Ph.D.
Bioinformatician,
Biological Services
Weizmann Institute of Science
POB 26
Rehovot 76100
Israel
e-mail: Ron.Ophir at weizmann.ac.il
Phone: 972-8-9342614
Fax:972-8-9344113
2012 Jul 13
3
R2OpenBUGS quesion
Dear All:
Could anybody help me figure out why I get the Error message below while I
running the example code of bugs() function in R2OpenBUGS packages? I have
tried the code both in Win 7 and Ubuntu 12.04, but they show the same
message. My R version is 2.15.1 in win7 and 2.15.0 in Ubuntu. Many thanks !
Best,
Yilong
> schools.sim <- bugs(data, inits, parameters, model.file,+
2013 Feb 25
1
quesion about SS of ANOVA
Hi all:
I have a quesion about ANOVA: Is SS(Sum of Square) of a specific factor constant with the number of factors changing?
dat1 includes one factor g1,and g1's SS is called SS_g1_dat1.
dat2 includes two factors g1,g2,and g1's SS is called SS_g1_dat2.
My quesion is: Is SS_g1_dat1 equals to SS_g1_dat2?
I have both "yes" and "no" reasons for the quesion,but
2011 May 03
1
Rodbc quesion: how to reliably determine the data type?
Hello,
How can I tell RODBC to scan all the records of an xls file to determine the
data type? If the first n records happen to be empty Rodbc assumes a character,
and any numbers are made <NA>. And if, for instance, the first n records contain
numbers, and later they also contain characters, those characters become NA.
Cheers!!
Albert-Jan
2013 Mar 09
2
quesion about lm function
Hi all:
My data is in the attachment.
I want to analysis the mean difference of y between 2 sex.
My code:
result_lm<-lm(y~factor(sex) + x1 + x2)
summary(result_lm)
The result of "factor(sex)m" 136.83, is the mean difference of y between 2 sex,and the corresponding p value is 0.07618.
My question is: how to get the mean y of sex(m) and sex(f) respectively via lm function?
Many
2020 Jun 01
1
eval and Calling Frames
I ran into an interesting issue with `evalq` (and also
`eval(quote(...))`):
???? f <- function() {
?????? list(
???????? sys.parent(1),
???????? evalq(sys.parent(1)),
???????? evalq((function() sys.parent(2))()),? # add an anon fun layer
???????? evalq((function() sys.parent(1))())
?????? )
???? }
???? res <- f()
???? str(res)
???? ## List of 4
???? ##? $ : int 0???????? # sys.parent(1)
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
In 3.1.2 eval does not store the result of the bquote-generated call in the
given environment. Interestingly, in 3.2.1 eval does store the result of
the bquote-generated call in the given environment.
In other words if I run the given example with eval rather than evalq, on
3.1.2 "x" is never stored in "fenv," but it is when I run the same code on
3.2.1. However, the given
2007 May 27
2
Question about "evalq"
The help page of eval says: The 'evalq' form is equivalent to
'eval(quote(expr), ...)'. But the following is not equivalent. Can
anyone give me some explaination? Thanks very much.
> f1 <- function(x,digits=5) lapply(x, f2)
> f2 <- function(x) eval(quote(print(x+1,digits=digits)),list(x=x),parent.frame(2))
> f1(list(x1=1))
[1] 2
$x1
[1] 2
>
> f1 <-
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote:
> I think rapply() was changed to act like lapply() in this respect.
>
When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was:
if (typeof(object) != "list")
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
Hello,
I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked
as I intended previously. Briefly, I am using bquote to generate
expressions to modify data.table objects within a function, so I need the
changes to actually be stored in the given environment. Previously, I used
code like the following:
test <- list(bquote(x <- 10))
fenv <- environment()
rapply(test,
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David,
If you are referring to the solution that would be:
rapply(list(test), eval, envir = fenv)
I thought I explained in the question that the above code does not work. It
does not throw an error, but the behavior is no different (at least in the
output or result). Using the above code still results in the x object not
being stored in fenv on 3.1.2.
Dayne
On Wed, Jul 15, 2015 at 4:40 PM,
2001 Oct 16
4
Assignment of structures on a given environment
Hi,
In order to avoid deep copies by passing large arguments to functions or
returning values, I'm trying to do the assignment of variables in a
given environment. The problem is when I try to assign a structure: a
list for example.
If I have:
ind <- c("a","b")
my idea is doing something like
l <- alist()
l[ind] <- as.list(c(20,40))
in a given
2013 Oct 07
1
search for variable in package in .GlobalEnv first
Hi
First, sorry if I get the terminology wrong, I am still quite new to the
concept of using environments and workspaces.
Say I have a statement in a package SIM like
sim <- TYPE
where the variable TYPE is initialized in the package to
e.g. "exponential" (SIM::TYPE == "exponential").
Now, I want to give the user the option of specifying the variable TYPE,
but to the
2002 Sep 04
3
strange things with eval and parent frames
Dear mailing list,
I have found some strange behaviour which I think relates to parent frames
and eval. Can anyone explain what's going on here?
First example:
> test.parent.funcs_ function() {
outer.var_ 5
subfunc1_ function() substitute( outer.var, envir=parent.frame())
print( subfunc1())
subfunc2b_ function() eval( quote( outer.var), envir=parent.frame())
print(
2015 Apr 01
4
evaluation in transform versus within
On 01/04/2015 1:35 PM, Gabriel Becker wrote:
> Joris,
>
>
> The second argument to evalq is envir, so that line says, roughly, "call
> environment() to generate me a new environment within the environment
> defined by data".
I think that's not quite right. environment() returns the current
environment, it doesn't create a new one. It is evalq() that created
2009 Jan 28
1
evaluation revisited
I'm still going over old emails and trying to get my head around
evaluation so I'm persistent if nothing else.
A while back , an expert sent me below as an exercise in understanding
and I only got around to it tonight. I understand some of the output but
not all of it and I put "Why not Zero ?" next to the ones that I don't
understand based on my reading of the various