I have a question about the function of line feeds/carriage returns in
an all linux (R, vi to write scripts) environment. In my scripts I have
a few functions, using { or ( to wrap commands on the next line.
Usually this is fine, but sometimes R appears confused by line wrappings
(more likely of course it is me who is confused). I tried ';' to
explictly break the line, but no dice.
An example (partial function).
inrange _ function(v,Y,s,z,mlv,met){
lower _ mean(v[data$yr==Y])-(var(v[data$yr==Y])^.5)
upper _ mean(v[data$yr==Y])+(var(v[data$yr==Y])^.5)
ML _ mlv[ML$yr==Y & ML$metcode==met]
diff _ 0
if (ML<lower) {diff <- lower-ML; # tried with and without ;
v <<- v-diff}
}
gives:
inrange _ function(v,Y,s,z,mlv,met){
+ lower _ mean(v[data$yr==Y])-(var(v[data$yr==Y])^.5)
+ upper _ mean(v[data$yr==Y])+(var(v[data$yr==Y])^.5)
+ ML _ mlv[ML$yr==Y & ML$metcode==met]
+ diff _ 0
+ if (ML<lower) {diff <- lower-ML; v <<- v-diff}}
inrange _ function(v,Y,s,z,mlv,met){
+ lower _ mean(v[data$yr==Y])-(var(v[data$yr==Y])^.5)
+ upper _ mean(v[data$yr==Y])+(var(v[data$yr==Y])^.5)
+ ML _ mlv[ML$yr==Y & ML$metcode==met]
+ diff _ 0
+ if (ML<lower) {diff <- lower-ML;
+
Display all 100 possibilities? (y or n)
ActualTen.dta .check.R.swl .marketFix.log.swp
.
.
contents of directory