Hi,
I wonder how to write a function that remembers its state across its
calls. For example, I would like to compute the average of the pass three
values the function has seen
f(1) # NA
f(2) # NA
f(3) # 2
f(4) # 3
This would require f to keep track of the values it has seen. In other
Hi Jens,
Thanks for the suggestions. I tried closing the ff file on one nfs client
and open that file from another client. It doesn't work.
Jeff
-Original Message-
From: Jens Oehlschlägel [mailto:oehl_l...@gmx.de]
Sent: Monday, January 25, 2010 5:07 PM
To: h...@andrew.cmu.edu
Cc:
Hi ff users and Jens,
I am using the ff package and it has been working great. Recently I
noticed an unexpected behavior in the ff package -- when I save an ff
matrix on one machine to an NFS drive and load it on another machine from
the save NFS drive, I got quote a lot of zeros in the matrix.
Hi,
I wonder anyone knows what causes the error message select: bad file
descriptor in the multicore package. This error sometimes occurs and
sometimes doesn't. I couldn't find any documentation on this error about
this package.
thanks
Jeff
__
.
thanks
Jeff
On Fri, January 8, 2010 7:56 pm, Henrik Bengtsson wrote:
library(R.utils); sourceDirectory(myRFiles/, modifiedOnly=TRUE);
See ?sourceDirectory (regardless what the Rd help say, any '...'
argument is passed to sourceTo()).
/Henrik
On Fri, Jan 8, 2010 at 7:38 AM, Hao Cen h
Hi,
I wonder what is a better way to organize a lot of R source files. I have
a lot of utility functions written and store them in several source files
(e.g util1.R, util2.R,..utilN.R). I also have a master file in which the
source command is used to load all the util.R files. When I need to use
Hi,
I have been using filehash for a while. It has performed very well.
However, recently I found filehash gives an error when I need to do
something like db[c(a, b)] when the db is in RDS format. Does any one
know a way to get around that?
The code below reproduces the error
thanks
Jeff
Hi,
I currently combine multiple processed data (data frame) into a list and
save the list as .rda using the save command. When new data come, I load
the rda file, process the new data into a data frame, append the data
frame to the end of the list, and save the whole list to the disk. The
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process(X)
...
process(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2),
g3(X, par3). par1, par2 and par3 are
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process1(X)
...
process2(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2),
g3(X, par3). par1, par2 and par3
here
process2(X)
}
On Tue, December 29, 2009 4:57 pm, Duncan Murdoch wrote:
On 29/12/2009 3:08 PM, Hao Cen wrote:
Hi,
I wonder how to pass several functions and their arguments as arguments
to a function. For example, the main function is
f = function(X ) { process1(X
Hi,
I have multiple responses y1, y2, .., yn, and would like to do linear
regression for each of them with x1, x2, ..., xm. Instead of doing
regression n times, it it possible to do it all at once?
I tried lm(y1+y2 ~ x1 + x2 + x3) and lm added y1 y2 and then did the
regression.
thanks
Jeff
Hi,
Is there a way to get the enclosing function name within a function?
For example, I would like to have a function getEnclosingFunctionName().
It works like below
f = function(){
print(getEnclosingFunctionName())
}
f() # will print f
Thanks
Jeff
Hi,
I would like to get the actual object name passed as a parameter of a
function and am using deparse(substitute(x)) to do that. It doesn't work
when it is used along with the foreach package. Appreciate if any one can
give some suggestions on how to make it work with foreach.
FUN.aaa -
:36 PM -0500 12/1/09, Hao Cen wrote:
Hi,
I have a a vector and a data frame with two columns
vec = c(C, A, B)
dataDF = data.frame(A1 = c(B, A, C), A2 = c(1,2,3))
I would like to sort the data frame by column A1 such that the order of
elements in A1 is as the same as in vec
Hi,
How can I find the index of the next largest element in a sorted vector if
an element is not found.
for example, searching 2 in c(0,3,4) would return 1 since 2 is not in the
vector and 0 is the next largest element to 2.
I tried which and match and neither returns such information.
Hi,
I have a a vector and a data frame with two columns
vec = c(C, A, B)
dataDF = data.frame(A1 = c(B, A, C), A2 = c(1,2,3))
I would like to sort the data frame by column A1 such that the order of
elements in A1 is as the same as in vec.
After the ordering, the data frame would be
: Monday, November 23, 2009 11:00 PM
To: Hao Cen
Cc: r-help@r-project.org
Subject: Re: [R] ow to have R automatically print traceback upon errors
I use this:
options(error=utils::recover)
and anytime an error occurs in the interactive mode, it will print out
the traceback and then allow you to explore
Hi Jens,
Thanks for your prompt and informative answers. ff is a fabulous package and
your suggestions helped me solve my problems at hands.
As I need to incrementally increase each of several large matrices (about
1000 rows *1 columns, 1000 matrices) by a row every day. I wonder how
Hi,
I have two questions on using the ff package and wonder if anyone who used
ff can share some thoughts.
I need to save a matrix as a memory-mapped file and load it back later. To
save the matrix, I use
mat = matrix(1:20, 4, 5)
matFF = ff(mat, dim=dim(mat), filename=~/a.mat, overwrite=TRUE,
Hi,
I wonder how to have R automatically print stack trace produced by
traceback upon errors during interactive uses. I tried the suggestions on
http://old.nabble.com/Automatically-execute-traceback-when-execution-of-script-causes-error--td22368483.html#a22368775
and used options(error =
Hi,
I am writing a function in C that is meant to be called by R. In the C
function, I used a gsl function gsl_stats_mean. The code is as simple as
below
void gsl(double *m, int *dim){
int r, c;
r = dim[0];
c = dim[1];
double mean = gsl_stats_mean(m[0], 1, r);
Hi,
I would like to extract the last row of each group in a data frame.
The data frame is as follows
Name Value
A 1
A 2
A 3
B 4
B 8
C 2
D 3
I would like to get a data frame as
Name Value
A 3
B 8
C 2
D 3
Thank you for your suggestions in advance
Jeff
Thanks to all who helped. These are all great suggestions.
Jeff
-Original Message-
From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Sent: Monday, November 16, 2009 6:27 PM
To: Hao Cen
Cc: r-help@r-project.org
Subject: Re: [R] extracting the last row of each group in a data
--
David
I hope it helps.
Best,
Dimitris
Hao Cen wrote:
Hi,
I have a matrix with positive numbers, negative numbers, and NAs. An
example of the matrix is as follows -1 -1 2 NA
3 3 -2 -1
1 1 NA -2
I need to compute a scaled version of this matrix. The scaling
method is dividing each
Hi,
I have C code to produce a lot of matrices to be analyzed. As these
matrices are large ( 1000*1) and are a lot ( 1000), I am thinking
about how to pass them from C to R effectively.
Would you think about the following solution? In R, I create a wrapper
function
passDataFromCToR =
Hi,
I have a matrix with positive numbers, negative numbers, and NAs. An
example of the matrix is as follows
-1 -1 2 NA
3 3 -2 -1
1 1 NA -2
I need to compute a scaled version of this matrix. The scaling method is
dividing each positive numbers in each row by the sum of positive numbers
in that
Hi Henrik,
I am using your saveObject/loadObject to handle over 1000 matrices. It
worked beautifully. Because I need to load those matrices often for
evaluating a few functions on them and those matrices do not fit all in
memory at once, is there a way to speed up the loading part? I tried save
Hi Henrik and David,
Thank you very much for your suggestions. I found both meet my needs.
In the following code, I found save(obj,file=pathname) would save the
content into an object called obj.
path - ~/;
dir.create(path);
for (i in 1:10) {
assign( paste(m, i, sep=), i:5)
filename -
29 matches
Mail list logo