Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A message needs a trailing newline #1538

Closed
franknarf1 opened this issue Feb 19, 2016 · 2 comments
Closed

A message needs a trailing newline #1538

franknarf1 opened this issue Feb 19, 2016 · 2 comments
Assignees
Milestone

Comments

@franknarf1
Copy link
Contributor

This is very minor. There should be a "\n" (or something) at the end of this message:

cat("Duplicate column names found in molten data.table. Setting unique names using 'make.names'")

Example from SO http://stackoverflow.com/q/35510535/1191259

DF = structure(list(value = 1:5, name = structure(1:5, .Label = c("A", 
"B", "C", "D", "F"), class = "factor"), X2015.cost = c(100, 200, 
250, 300, 450), X2016.cost = c(200, 300, 350, 400, 550), X2017.cost = c(300, 
400, 450, 500, 650), X2015.profit = c(1000, 4200, 2450, 1500, 
7650), X2016.profit = c(1300, 4300, 3450, 5100, 6850), X2017.profit = c(1300, 
4400, 6450, 5001, 6500)), .Names = c("value", "name", "X2015.cost", 
"X2016.cost", "X2017.cost", "X2015.profit", "X2016.profit", "X2017.profit"
), row.names = c(NA, -5L), class = "data.frame")

dcast(melt(DF, id.vars = c("value","name"))[, 
    c("year", "col_type") := tstrsplit(variable, "\\.")
][,
    year := as.integer(sub("\\D","", year))
], value+name+year ~ col_type)

# which produces...
Duplicate column names found in molten data.table. Setting unique names using 'make.names'    value name year cost profit
 1:     1    A 2015    1      1
 2:     1    A 2016    1      1
 3:     1    A 2017    1      1
 4:     2    B 2015    2      2
 5:     2    B 2016    2      2
 6:     2    B 2017    2      2
 7:     3    C 2015    3      3
 8:     3    C 2016    3      3
 9:     3    C 2017    3      3
10:     4    D 2015    4      4
11:     4    D 2016    4      4
12:     4    D 2017    4      4
13:     5    F 2015    5      5
14:     5    F 2016    5      5
15:     5    F 2017    5      5

Note that the column names in the result are on the same line as the preceding warning/notification.

@MichaelChirico
Copy link
Member

Seems "\n" is the standard approach for data.table:

https://github.com/Rdatatable/data.table/search?utf8=%E2%9C%93&q=cat

PR encouraged =D

@arunsrinivasan
Copy link
Member

PRs are much better fit for these types of issues.

@arunsrinivasan arunsrinivasan added this to the v1.9.8 milestone Feb 23, 2016
@arunsrinivasan arunsrinivasan self-assigned this Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants