Displaying 20 results from an estimated 200 matches similar to: "Global variables"
2011 Mar 24
3
Extract the names of the arguments in an "expression"
Hi everybody:
I need to get the names of the arguments in an object of class "expression".
I've got the following expression:
> x <- expression(rho * cos(omega))
Is there any function or procedure that returns the names of the arguments
(in the example: "rho" and "omega")?
I tried a rough approach implemented in the function expr.args() shown
below. As
2008 Apr 07
3
findGlobals on apply
Hi the list,
Considere the following:
f <- function(x){apply(x,2,mean)}
findGlobals(f)
findGlobals consideres mean as a global variable, which it is not.
Is there a way to tell to findGlobals that mean is a function ?
Thanks
Christophe
2007 Dec 16
2
clean programming
Hello the list,
I am trying to write a "cleanProgramming" function to test the
procedure I use. For example, I want to be sure that I am not using
globals variables. The function "findGlobals" detect that.
To list the globals used in function "fun", the syntax is :
"findGlobals(fun,FALSE)$variable"
My problem is that I want to use it in a function,
2013 Apr 11
2
(no subject)
Dear all,
Is there a quick and easy way of converting utf characters to the \uxxxx
form (necessary e.g. for packages)? I mean something working like this:
> utf2uxxxx("õäöü")
[1] "\u00f5\u00e4\u00f6\u00fc"
It is easy to program but perhaps someone already has implemented this. (I
couldn't find anything useful from searches incl RSiteSearch).
Thanks in advance,
Kenn
2011 Mar 03
1
sqlFetch (RODBC) question
Dear all,
I've used RODBC a lot to read in files created in MS excel and access but
found a strange problem today: a variable in my data file contained both
numbers and text; sqlFetch would set text within a row of numbers to NA; but
if first 5 or 6 rows would be text then all numbers would be read in as NA.
con<-odbcConnectExcel("xample.xls") #the file is attached or at
2011 Mar 25
2
Preserving the class of POSIXt objects
Dear all,
I am working with a list of objects each of which contains two POSIXct
objects (say, $Start and $End) and a number of different data in
addition to that. Now an easy way to extract Start times of all object
could be sapply(x, "[", "Start") but this converts them all to
numeric, and so does sapply(x, "[[", "Start"). lapply preserves the
class but
2007 Oct 12
2
Q-type factor analysis
Hallo!
Is there a package in R that does Q-type factor analysis?
I know how to do principal component analysis, but haven't found any application of Q-type factor analysis.
Thx,
Julia
--
Psssst! Schon vom neuen GMX MultiMessenger geh?rt?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
2013 Jan 16
2
Codetools Query (repost)
Sorry for reposting, i keep forgetting this should be plain text.
Will not make this mistake again
Hello,
The following code
moo <- function(a=1){ x=1; x=x+y}
funs <- new.env()
enter <- function(type, v, e, w){
assign(v, TRUE, funs)
}
library(codetools)
collectUsage(moo, enterGlobal = enter)
adds + to the environment funs i.e.
funs: "=" "{" "+"
2011 Apr 10
4
Password-protect R script files
There was a question in R forum very long time back.. on how to protect R
Script files from inadvertent editing by users.
There is a way to do this from within R, atleast in Windows XP I have tried
this and it certainly works , The method is very different from the OS
based folder protection route, however making available such a method in
the open forum would only kill the very spirit of R.
2013 Sep 18
2
cov2cor exp
Ok, Thanks foe the answer, Ken:
*1L, 2L etc are integers. (That is, identical to as.integer(1) ,
as.integer(2) etc)
Using integers (instead of "numeric" type) is more efficient as here they're
used as indexes and would be converted to integer anyway.
Compare
> is(1)
... and
> is(1L)
1L:p is the sequence 1, 2, 3, ..., p (just like 1:p)
Just for curiosity, what is
2012 Jun 23
1
globalVariables()
Dear r-devel list members,
By placing a call to the new (with R 2.15.1) globalVariables() in the development version of the Rcmdr package, I've succeeded in reducing the "notes" produced by R CMD check from dozens to two. But I still get the following notes, even though '.commander.done' is in the call to globalVariables():
------------- snip ------------
* checking R code
2011 May 04
4
Recursive objects
Hi all,
Does anyone have a comprehensive list of recursive-type objects in R?
is.recursive defines them as by exclusion: "most types of objects are
regarded as recursive, except for vector types, ?NULL? and symbols
(as given by ?as.name?)." I think this that means recursive objects
are:
* lists
* pairlists
* calls
* expressions
Did I miss anything?
Hadley
--
Assistant
2011 Jan 04
5
scoping/non-standard evaluation issue
Dear r-devel list members,
On a couple of occasions I've encountered the issue illustrated by the
following examples:
--------- snip -----------
> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed +
+ Armed.Forces + Population + Year, data=longley)
> mod.2 <- update(mod.1, . ~ . - Year + Year)
> all.equal(mod.1, mod.2)
[1] TRUE
>
> f <-
2010 May 12
1
Xen 4.0 with Remus on Suse 10.1??
Hello,
I am trying to set up a Xen/Remus test configuration on AMD64 hardware
(HP DL380 G6) under SuSE 10.1 and am having trouble.
I was able to run and configure the Xen 3 that came with SuSE fine, but
as far as I can see, I have to use Xen 4 to get Remus.
I managed to build Xen 4 from source and it seemed to install, but I am
not sure how to get the proper kernel and/or initrd files in place
2003 Mar 01
1
bootable dvd
Is it possible to use isolinux to create a bootable dvd? I have a .iso
that boots fine from cd but not from dvd.
I have a Dell OptiPlex GX240 with dvd/cd drive. Dont know for sure if
the bios requires an update to boot dvd.
Any info would be appreciated.
Thanks,
Kenn White
(801)861-3737
kpwhite at novell.com
Zenworks for Desktops
http://www.novell.com/products/zenworks/awards.html
Novell, Inc.,
2008 Apr 29
1
Consecutive zeros in a vector
Suppose X is a long vector of integers (typically about 30000 elements). Is
there an efficient way to detect whether there are at least N consecutive
zeros in X, and if yes, where does this occur?
for example, suppose X is:
1 2 3 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 2 0 1 2 0 0 0 2 2 2 2 2 ...
and N is 10. I would like a foo(X, 10) to return something like c(6,19)
(start and end positions in X
2008 Jul 11
1
Subsetting an array by a vector of dimensions
Hi
Is it possible to subset an n-dimensional array by a vector of n dimensions? E.g. assume I have
> x <- array(1:24, dim=2:4)
> x[1,1,2]
[1] 7
> dims <- c(1,1,2)
I would like a function that I can supply x and dims as parameters to, and have it return 7. Also, I would like to do something like:
> x[1,1,]
[1] 1 7 13 19
> dims2<- c(1,1,NA)
And have a function of x and
2007 Nov 22
2
Clean programming with R
Hi all
Is there any compiler for R ? By compiler, I mean something that check
the cleanliness of the code : if we declare all the variables we use, if
we don't use external variable from a function and so on...
For exemple, something that will ring a bell on the following code
(saying "line 4 : 'pp' undefine in function 'power' ")
1. pp <- 3
2. power <-
2007 Oct 19
2
Declaring variables in R
Please forgive me if my question is answered in Help
FAQ no. 23481739...
In language like C every variable must be declared
before it can be used.
In VBA, if a variable has not been declared it is
assumed to be of a special type (Variant).
In R (and Matlab) variables do not have to be
declared. This is convenient, but in a large program
one can make a typo which will be extremely difficult
to
2011 Mar 16
2
Detecting bad lexical scoping
I've recently hunted down a troublesome bug in my own code, and am
looking for an easy mechanism to detect this kind of error in other R
code. The problem was an undefined variable inside of a function.
Unfortunately, R looked for that variable in the global environment
and found it since there was variable with that name in my testing
scripts (note to self: do not name things "x").