similar to: get caller's name

Displaying 20 results from an estimated 1000 matches similar to: "get caller's name"

2011 Nov 01
4
building a subscript programatically
Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not known in advance) number of dimensions. How do you deal with these situations? It appears that it is not possible use a list as an index, for instance this fails: > x <- array(NA, c(2,2,2)) > x[list(TRUE,TRUE,2)] Error in x[list(TRUE, TRUE, 2)] : invalid subscript type 'list' The only way I know is
2012 Feb 08
3
R equivalent of Python str()?
Hi, I was wondering if there's a function in R that is meant to return a string representation of an object. Basically, it's like print() but it doesn't print anything, it only returns a string. I know there's a str() function but it's not quite the same. I mean a function that returns the same string that print() would display. -- Bye, Ernest
2011 Jan 28
3
sapply puzzlement
Hi, I have this data.frame with two variables in it, > z V1 V2 1 10 8 2 NA 18 3 9 7 4 3 NA 5 NA 10 6 11 12 7 13 9 8 12 11 and a vector of means, > means <- apply(z, 2, function (col) mean(na.omit(col))) > means V1 V2 9.666667 10.714286 My intention was substracting means from z, so instictively I tried > z-means V1 V2 1 0.3333333
2012 Jan 31
1
dimensions dropped on assignment
Hi there, This is a problem I've run into and do not know how to avoid. It happens when I make an assignment using the dimension names as the subscript of the array. The end result is a dimenensionless array (i.e. a vector) which I don't want. See: > out <- array(0, 5, list(1:5)) > dim(out) [1] 5 > out[names(out)] <- 1 > dim(out) NULL I tried to include a
2011 Nov 23
1
how to stack a list of arrays
Hello, I have this list of 2-d arrays: $`0` k d [1,] 0.2011962 4.019537 [2,] 0.2020706 5.722719 [3,] 0.2029451 7.959612 $`1` k d [1,] 0.3148325 2.606903 [2,] 0.3160287 3.806665 [3,] 0.3172249 5.419222 $`2` k d [1,] 0.2332536 4.949390 [2,] 0.2342188 7.115258 [3,] 0.2351840 9.955909 which I need to transform into a data frame like this
2011 Aug 15
1
accumulative grouping of time series
HI there, Consider a data set like this: > x <- data.frame(a=1:10, b=11:20, t=c(1,1,1,2,2,2,3,3,3,3)) > x a b t 1 1 11 1 2 2 12 1 3 3 13 1 4 4 14 2 5 5 15 2 6 6 16 2 7 7 17 3 8 8 18 3 9 9 19 3 10 10 20 3 Here x$t is a vector of integers that represent a moment in time. I would like to calculate a function of a & b at each moment (t0), but using the rows
2006 Nov 21
2
keeping dim() for array
Hi All, I noticed the following: pip = array(1:6, dim = c(3,2)) dim(pip) [1] 3 2 pup = pip[1,] dim(pup) NULL I bet there is a *good* reason why one row of an array is *dimensionless*, but it's highly inconvenient for my purpose, i.e. to use apply() after an array goes through a number of logical steps and is redimensioned, sometimes to one single row. How do I keep dim(pup) to 1 2?
2012 Jun 08
3
Rose plot (like a windrose)
Dear R Gurus, I spent some time in looking for help but didn't find a way to do what I want. I do have a vector (in Degrees) containing of 360 elements, one element per degree on a circle. The data is dimensionless and in the range of -0.2 to 0.5. An Example: Wind Dir [degrees], Value 1, 0.1 2 , 0.3 3 , 0.01 .,. .,. 180,-0.01 181,-0.2 .,. .,. .,. 359,.0.3 360,.0.5 Now I want to have
2009 Feb 06
1
Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: "limited arithmetic is available on 'difftime' objects"; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error:
2009 Feb 06
1
Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: "limited arithmetic is available on 'difftime' objects"; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error:
2008 Oct 30
2
Adding PDU support to NUT
I've recently been working a bit on adding PDU (http://en.wikipedia.org/wiki/Power_distribution_unit) support in NUT. Some of you might have seen the Powerman thread, which also deals with adding more PDUs support: http://powerman.sourceforge.net/supported.html The result is that we now have support for 2 Eaton | Powerware ePDUs (Managed and Monitored iirc, check http://www.epdu.com). I plan
2016 May 23
2
data frame method for as.table()
Hello, Currently it's possible to convert an object of class table to a data frame with as.data.frame.table(), but there's no ready-made function, AFAIK, to do the reverse operation, i.e. conversion of a data frame to a table. Do you think it would be a good idea to add a data.frame method to as.table(), to allow such conversions? The idea is that if `x' is a table and `y <-
2004 Mar 23
3
how to modify variables of another frame (but not global)
Hello! Maybe "frame" is not the right term in this context. I explain my problem by example code: fun2 <- function(objName, add) { ## the object "objName" should be increased by "add", ## but the evaluation should be done in the calling function (here: fun1) ## ...... what's the right code?? } fun1 <- function() { x <- 1 fun2("x",
2012 Apr 24
2
load only one object from a .RData file
Hi list, Is there a way to load one specific object from a .RData file which contains multiple data objects?? Thanks, ...Tao
2007 Feb 23
2
Functions that write functions in R packages
Dear all, Another question related to my ggplot package: I have made some substantial changes to the backend of my package so that plot objects can now describe themselves much better. A consequence of this is that a number of convenience functions that previously I wrote by hand, can now be written automatically. What is the best practice for creating these functions for bundling in a
2012 Jan 30
1
Quantum scalar i40 tape partitions
Hi All, I have a Quantum scalar i40 tape library. I need to configure it to TWO tape partition libraries, e.g., library_a and library_b, so that each library has its own tape drive. Then connect this physical tape library to two different CentOS servers so that each server can see its own media changer and tape drive. I once had a successful configuration on one host but NOT on the other. One
2004 Nov 25
4
Avoiding for-loops
Hello R-users, I have a symmetric matrix of numerical values and I want to obtain those values in the upper or lower triangle of the matrix in a vector. I tried to do the job by using two for-loops but it doens't seem to be a clever way, and I'd like to know a more efficient code for a large matrix of thousands of rows and columns. Below is my code for your reference. Thanks a lot.
2007 Mar 06
2
bug: sticky symbol refs? (PR#9555)
Hello. What happens in the following is that I create two simple functions, f and g, on the workspace. Then I replace g. When I then call f, it uses the old version of g. Now clearly, the circumstances for this to happen must be quite special and rare. But I'd say they're not pathological. It seems to require two things: 1) masked versions of f and g on a search position lower down the
2010 Apr 23
2
Matrix diagonal help
Hi Suppose I have a matrix (cohort are rows and years are columns) [2000] [2001] [2002] [2003] [C1] 0.01 0.03 0.02 0.09 [C2] 0.06 0.05 0.07 0.11 [C3] 0.1 0.5 0.4 0.98 [C4] 0.7 0.6 0.2 0.77 I want to extracts the diagonals to get a matrix which looks like this (C1 becomes C2 in 2002, C2 becomes C3 in 2003
2005 May 19
14
R annoyances
Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using "apply" row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite