[R] Code formatting question - too ugly?
john.archie.mckown at gmail.com
Tue Jul 22 16:36:18 CEST 2014
I like to keep the individual lines in my source files relatively
short. Mainly so that I can print them, email them, or display them on
a narrow screen without needing to shift left & right. So, for a
really long character string, such as an SQL query, I do something
query=paste0("select CONVERT(smalldatetime,Int_Start_Date,11) as
" CONVERT(smalldatetime,CASE WHEN Int_Start_Time is NULL
then '00:00' ",
LEFT(Int_Start_Time,2)+':'+SUBSTRING(Int_Start_Time,3,2) end +",
"':00', 14) as Int_Start_Time",
", Int_duration, RTRIM(INTTYPE) AS INTTYPE,"
" RTRIM(Int_descr) AS Int_descr",
", RTRIM(INTSUBT) as INTSUBT, "
"INDEXX, RTRIM(Label) AS Label",
", RTRIM(CHANGED) AS CHANGED, "
"RTRIM(ALERT) AS ALERT, "
"RTRIM(RELEASE) AS RELEASE",
" FROM CPINTVL where Int_Start_Date BETWEEN '",
startDateChar,"' and '",endDateChar,"'"
So, just as an opinion, is the above "ugly looking" code compared to
just having a really long line? Also, if you/re curious, when I
started most programs were literally punched onto 80 column cards or
displayed on 80 column screens. I still have some damage from this
There is nothing more pleasant than traveling and meeting new people!
More information about the R-help