[MediaWiki-commits] [Gerrit] Avoid superfluous warning - change (wikimedia...golden)

2015-11-23 Thread OliverKeyes (Code Review)
OliverKeyes has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/254863

Change subject: Avoid superfluous warning
..

Avoid superfluous warning

With data.tables you can use setnames(x, y_old, y_new) rather than 
names(x[y_old])<-y_new
which is far more efficient. Most importantly, though, it doesn't shout at you.

Change-Id: I8523bbe4502a19f8312c0208354387dda940
---
M search/LDN.R
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/golden 
refs/changes/63/254863/1

diff --git a/search/LDN.R b/search/LDN.R
index 2c5bdef..e9be3ce 100644
--- a/search/LDN.R
+++ b/search/LDN.R
@@ -23,10 +23,12 @@
   # Get data and format:
   data <- query_func(fields = "SELECT * ", date = date, table = table)
   data$timestamp <- lubridate::ymd_hms(data$timestamp)
+  
   # Backwards-compatibility:
   if ( table == "TestSearchSatisfaction2_14098806" ) {
-names(data) <- sub('event_pageViewId', 'event_pageId', names(data))
+setnames(data, "event_pageViewId", "event_pageId")
   }
+  
   # Treat each individual search session as its own thing, rather than 
belonging
   #   to a set of other search sessions by the same user.
   page_visits <- ddply(data, .(event_searchSessionId, event_pageId),

-- 
To view, visit https://gerrit.wikimedia.org/r/254863
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8523bbe4502a19f8312c0208354387dda940
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/golden
Gerrit-Branch: master
Gerrit-Owner: OliverKeyes 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid superfluous warning - change (wikimedia...golden)

2015-11-23 Thread Bearloga (Code Review)
Bearloga has submitted this change and it was merged.

Change subject: Avoid superfluous warning
..


Avoid superfluous warning

With data.tables you can use setnames(x, y_old, y_new) rather than 
names(x[y_old])<-y_new
which is far more efficient. Most importantly, though, it doesn't shout at you.

Change-Id: I8523bbe4502a19f8312c0208354387dda940
---
M search/LDN.R
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Bearloga: Verified; Looks good to me, approved



diff --git a/search/LDN.R b/search/LDN.R
index 2c5bdef..e9be3ce 100644
--- a/search/LDN.R
+++ b/search/LDN.R
@@ -23,10 +23,12 @@
   # Get data and format:
   data <- query_func(fields = "SELECT * ", date = date, table = table)
   data$timestamp <- lubridate::ymd_hms(data$timestamp)
+  
   # Backwards-compatibility:
   if ( table == "TestSearchSatisfaction2_14098806" ) {
-names(data) <- sub('event_pageViewId', 'event_pageId', names(data))
+setnames(data, "event_pageViewId", "event_pageId")
   }
+  
   # Treat each individual search session as its own thing, rather than 
belonging
   #   to a set of other search sessions by the same user.
   page_visits <- ddply(data, .(event_searchSessionId, event_pageId),

-- 
To view, visit https://gerrit.wikimedia.org/r/254863
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8523bbe4502a19f8312c0208354387dda940
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/golden
Gerrit-Branch: master
Gerrit-Owner: OliverKeyes 
Gerrit-Reviewer: Bearloga 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits