[R] Several simple but hard tasks to do with R

Paul Hiemstra p.hiemstra at geo.uu.nl
Thu Aug 20 09:59:32 CEST 2009


Rakknar wrote:
>     Hello everybody. I've been learning R for about a month to do a
> econometric study and now i'm stuck with some problems to make R do the
> things I want. Here I give the list of things I wanna do from the most
> simple to the more complex (for me of course):
>
> 1. Make a log. I've been using Stata and there i have a great tool to
> register what the program do: the log file, wich it's a simple .txt file
> where Stata writes every output it makes (not graphics of course). When I
> wanted to make the same thing with R I started to use the function sink()
> but it only register the results of the commands (summaries for example) and
> not the commands itself, witch it's really uncomfortable because it's harder
> to find out to witch command that results come from.
>   
Hi,

I would recommend not using the command line as such too much. Making a 
script on your harddrive and always working from that seems a better to 
me. If you have some data on your harddrive (csv for example) you can 
write a script that takes that data and produces your results (graphs, 
lm's etc). This ensures that you can always later see how you have done 
your analysis, and redo if necessary. See also this e-mail on R-help 
http://www.nabble.com/PowerCut-Killed-R---is-my-code-retrievable--td25052662.html#a25052662.

cheers and hope this helps,
Paul
> 2. Saving objects in a .Rdata step by step. I want to save several
> regressions of interest in one .Rdata file. I want to save this results one
> by one. For example: make regression 1, save the result in the .Rdata file;
> then make the regression 2 and save the results in the same .Rdata file. I
> know I could make all the regressions and save the results all at once but
> for the kind of study I want to make It would be much useful this way. I've
> been using function save() but I only could save one result or all.
>
> 3. Conditional reading. I want to run regressions conditional to the
> existence of a .Rdata file (the one I would be making in step two). The
> condition would be something like
> If "you find X.Rdata file" run regression with X.Rdata data else run
> regression from the 0.
>
> I hope I can find help here.
>
> Thanks!!
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul




More information about the R-help mailing list