Re: [Rd] How to generate dependency file that can be used by gnu make?

2009-11-17 Thread Peng Yu
This may not easy to do, when the filename are not hard coded strings.
For example, the variable 'filename' is a vector of strings.

for (i in 1:length(filename)){
do something...
save(,file=filename[i])
}

On Mon, Nov 16, 2009 at 11:33 PM, Linlin Yan yanlinli...@gmail.com wrote:
 I don't think this function is same as gcc's option -MM. Because gcc
 checks pre-compile command #include, in which the filename can be
 fetched definitely. But in your scenario, the filename may be from
 some variables, which can not be determined by the R script only.
 Maybe you can write a tool by yourself to parse the R syntax to
 resolve your problem.

 On Tue, Nov 17, 2009 at 11:51 AM, Peng Yu pengyu...@gmail.com wrote:
 On Sun, Nov 15, 2009 at 8:45 PM, Peng Yu pengyu...@gmail.com wrote:
 gcc has options like -MM, which can generate the dependence files for
 a C/C++ file that I can be used by gnu make. I'm wondering if there is
 a tool that can generate dependence file for an R script.

 For example, I have an R script test.R

 #test.R
 load('input.RData')
 save.image('output.RData')


 I want to generate a dependence file like the following. Is there a
 tool to do so?

 output.RData:test.R input.RData

 Is there a way to automatically generate the output files that depends
 on an R script and the input files and sourced files that are depended
 by an R script? I don't see this option in R. But I wish this can be
 implemented in future version of R.

 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to generate dependency file that can be used by gnu make?

2009-11-17 Thread Seth Falcon

On 11/17/09 5:02 AM, Peng Yu wrote:

This may not easy to do, when the filename are not hard coded strings.
For example, the variable 'filename' is a vector of strings.

for (i in 1:length(filename)){
do something...
save(,file=filename[i])
}



That's right.  I don't think there is a feasible general solution.  You 
might have more success with a convention-based approach for your 
scripts that would allow a simple parser to identify output files by 
name convention, for example.


+ seth

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to generate dependency file that can be used by gnu make?

2009-11-16 Thread Peng Yu
On Sun, Nov 15, 2009 at 8:45 PM, Peng Yu pengyu...@gmail.com wrote:
 gcc has options like -MM, which can generate the dependence files for
 a C/C++ file that I can be used by gnu make. I'm wondering if there is
 a tool that can generate dependence file for an R script.

 For example, I have an R script test.R

 #test.R
 load('input.RData')
 save.image('output.RData')


 I want to generate a dependence file like the following. Is there a
 tool to do so?

 output.RData:test.R input.RData

Is there a way to automatically generate the output files that depends
on an R script and the input files and sourced files that are depended
by an R script? I don't see this option in R. But I wish this can be
implemented in future version of R.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel