|
The guide of R Code style recommends to write script with a maximal
length of 80 characters? how to break a line longer than 80 characters like filename_name <- ("/blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/"/ blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/data.csv") I did not find any answer while googling. Thank you! ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo
ooooooooong chaaaaaaaaarrr" Although the indentation is just personal preference. -------------------------------------- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 "Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it." - Jubal Early, Firefly ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
To elaborate, expressions and any explicit enclosures can also be simply
split between lines. Often, this is done without space issues just for clarity. EX: vec <- c(LETTERS[1:5], 1:5, letters[1:5]) plot(X, Y, main = "A plot", xlab = "X Values", ylab = "Response", lty = 1, pch = 5, cex = .75) num <- ((a1 + a2 + a3)/b1 + (a4 + a5 + a6)/b2) / b3 -------------------------------------- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 "Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it." - Jubal Early, Firefly [hidden email] wrote on 01/10/2011 09:04:23 AM: > [image removed] > > Re: [R] how to wrap a long line in R scripts? > > Jonathan P Daily > > to: > > Tutu2008 > > 01/10/2011 09:09 AM > > Sent by: > > [hidden email] > > Cc: > > r-help, r-help-bounces > > a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo > ooooooooong chaaaaaaaaarrr" > > Although the indentation is just personal preference. > -------------------------------------- > Jonathan P. Daily > Technician - USGS Leetown Science Center > 11649 Leetown Road > Kearneysville WV, 25430 > (304) 724-4480 > "Is the room still a room when its empty? Does the room, > the thing itself have purpose? Or do we, what's the word... imbue it." > - Jubal Early, Firefly > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
In reply to this post by Chao
On 2011-01-10 02:36, Tutu2008 wrote:
> The guide of R Code style recommends to write script with a maximal > length of 80 characters? > > how to break a line longer than 80 characters like > filename_name<- ("/blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/"/ > blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/data.csv") > I would use file.path() on the pieces that go into your filename. Peter Ehlers > I did not find any answer while googling. > > > Thank you! > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
In reply to this post by Jonathan P Daily
"Jonathan P Daily" <[hidden email]> wrote in message news:[hidden email]... >a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo > ooooooooong chaaaaaaaaarrr" > > Although the indentation is just personal preference. > -------------------------------------- > Jonathan P. Daily > Technician - USGS Leetown Science Center > 11649 Leetown Road > Kearneysville WV, 25430 > (304) 724-4480 > "Is the room still a room when its empty? Does the room, > the thing itself have purpose? Or do we, what's the word... imbue it." > - Jubal Early, Firefly > Did you test that? Printing a to see the result so the commands are ------------- a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo ooooooooong chaaaaaaaaarrr" a ---------------------------- Pasting directly into Rgui > a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo + ooooooooong chaaaaaaaaarrr" > a [1] "reaaaaaaaaaaaaaaaallllllllyyyyy looooo\n ooooooooong chaaaaaaaaarrr" Saving to file 'test.r' and sourcing > source("C:\\Documents and Settings\\jewell\\Desktop\\test.r", echo=TRUE) > a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo + ooooooooong chaaaaaaaaarrr" > a [1] "reaaaaaaaaaaaaaaaallllllllyyyyy looooo\n ooooooooong chaaaaaaaaarrr" I don't think this is what the OP wanted. I guess he wants "reaaaaaaaaaaaaaaaallllllllyyyyy loooooooooooooong chaaaaaaaaarrr" I don't know the answer (other than, as suggested by Peter Ehlers") to build it bit by bit. KJ ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
Oops! Good catch. I have been coding in python and R recently and now I'm
mixing conventions ... R's automatic line wrapping and Python's auto-catenation given a line wrap (via '\'). A better solution would be: a <- paste("reaaaaaaaaaaaaaaaallllllllyyyyy looooo", "ooooooooong chaaaaaaaaarrr", sep = "") print(a) -------------------------------------- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 "Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it." - Jubal Early, Firefly [hidden email] wrote on 01/10/2011 09:51:28 AM: > [image removed] > > Re: [R] how to wrap a long line in R scripts? > > Keith Jewell > > to: > > r-help > > 01/10/2011 09:54 AM > > Sent by: > > [hidden email] > > > "Jonathan P Daily" <[hidden email]> wrote in message > > >a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo > > ooooooooong chaaaaaaaaarrr" > > > > Although the indentation is just personal preference. > > -------------------------------------- > > Jonathan P. Daily > > Technician - USGS Leetown Science Center > > 11649 Leetown Road > > Kearneysville WV, 25430 > > (304) 724-4480 > > "Is the room still a room when its empty? Does the room, > > the thing itself have purpose? Or do we, what's the word... imbue it." > > - Jubal Early, Firefly > > > > Did you test that? Printing a to see the result so the commands are > ------------- > a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo > ooooooooong chaaaaaaaaarrr" > a > ---------------------------- > Pasting directly into Rgui > > a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo > + ooooooooong chaaaaaaaaarrr" > > a > [1] "reaaaaaaaaaaaaaaaallllllllyyyyy looooo\n ooooooooong > chaaaaaaaaarrr" > > Saving to file 'test.r' and sourcing > > source("C:\\Documents and Settings\\jewell\\Desktop\\test.r", > > a <- "reaaaaaaaaaaaaaaaallllllllyyyyy looooo > + ooooooooong chaaaaaaaaarrr" > > a > [1] "reaaaaaaaaaaaaaaaallllllllyyyyy looooo\n ooooooooong > chaaaaaaaaarrr" > > I don't think this is what the OP wanted. > I guess he wants "reaaaaaaaaaaaaaaaallllllllyyyyy loooooooooooooong > chaaaaaaaaarrr" > > I don't know the answer (other than, as suggested by Peter Ehlers") to > it bit by bit. > > KJ > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
| Powered by Nabble | See how NAML generates this page |
