Changeset: 59c3c655ec59 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=59c3c655ec59
Modified Files:
clients/R/Tests/dplyr.R
clients/R/Tests/dplyr.stable.out
Branch: default
Log Message:
R Connector: dplyr test and approved output
diffs (113 lines):
diff --git a/clients/R/Tests/dplyr.R b/clients/R/Tests/dplyr.R
--- a/clients/R/Tests/dplyr.R
+++ b/clients/R/Tests/dplyr.R
@@ -55,28 +55,28 @@ cc <- collect(batting)
# Data manipulation verbs ---------------------------------------------------
-nrow(head(filter(batting, yearID > 2005, G > 130), n=10L))
-nrow(head(select(batting, playerID:lgID), n=10L))
-nrow(head(arrange(batting, playerID, desc(yearID)), n=10L))
+nrow(head(filter(batting, yearID > 2005, G > 130), n=11L))
+nrow(head(select(batting, playerID:lgID), n=12L))
+nrow(head(arrange(batting, playerID, desc(yearID)), n=13L))
length(summarise(batting, G = mean(G), n = n())) > 1
-nrow(head(mutate(batting, rbi2 = if(!is.null(AB) & AB > 0) 1.0 * R / AB else
0), n=10L))
+nrow(head(mutate(batting, rbi2 = if(!is.null(AB) & AB > 0) 1.0 * R / AB else
0), n=14L))
# note that all operations are lazy: they don't do anything until you
# request the data, either by `print()`ing it (which shows the first ten
# rows), by looking at the `head()`, or `collect()` the results locally.
-nrow(head(collect(filter(batting, yearID > 2010)), n=10L))
+nrow(head(collect(filter(batting, yearID > 2010)), n=15L))
# Group by operations -------------------------------------------------------
# To perform operations by group, create a grouped object with group_by
players <- group_by(batting, playerID)
length(group_size(players)) > 1
-nrow(head(summarise(players, mean_g = mean(G), best_ab = max(AB)), n=10L))
+nrow(head(summarise(players, mean_g = mean(G), best_ab = max(AB)), n=16L))
# When you group by multiple level, each summarise peels off one level
per_year <- group_by(batting, playerID, yearID)
stints <- summarise(per_year, stints = max(stint))
-nrow(head(filter(stints, stints > 3), n=10L))
-nrow(head(summarise(stints, max(stints)), n=10L))
+nrow(head(filter(stints, stints > 3), n=17L))
+nrow(head(summarise(stints, max(stints)), n=18L))
# Joins ---------------------------------------------------------------------
player_info <- select(tbl(dps, "Master"), playerID,
@@ -87,25 +87,25 @@ hof <- select(filter(tbl(dps, "HallOfFam
invisible(suppressMessages( {
# Match players and their hall of fame data
-print(nrow(head(inner_join(player_info, hof), n=10L)))
+print(nrow(head(inner_join(player_info, hof), n=20L)))
# Keep all players, match hof data where available
-print(nrow(head(left_join(player_info, hof), n=10L)))
+print(nrow(head(left_join(player_info, hof), n=21L)))
# Find only players in hof
-print(nrow(head(semi_join(player_info, hof), n=10L)))
+print(nrow(head(semi_join(player_info, hof), n=22L)))
# Find players not in hof
-print(nrow(head(anti_join(player_info, hof), n=10L)))
+print(nrow(head(anti_join(player_info, hof), n=23L)))
}))
# TODO: set ops
# sample functions
-print(nrow(sample_n(player_info, 10L)))
-print(nrow(head(sample_frac(player_info, .5), n=10L)))
+print(nrow(sample_n(player_info, 24L)))
+print(nrow(head(sample_frac(player_info, .5), n=25L)))
# Arbitrary SQL -------------------------------------------------------------
# You can also provide sql as is, using the sql function:
batting2008 <- tbl(dps,
sql('SELECT * FROM "Batting" WHERE "yearID" = 2008'))
-nrow(head(batting2008, n=10L))
+nrow(head(batting2008, n=26L))
print("SUCCESS")
diff --git a/clients/R/Tests/dplyr.stable.out b/clients/R/Tests/dplyr.stable.out
--- a/clients/R/Tests/dplyr.stable.out
+++ b/clients/R/Tests/dplyr.stable.out
@@ -27,21 +27,23 @@ Ready.
[1] TRUE
[1] TRUE
[1] 10
-[1] 10
-[1] 10
-[1] 10
+[1] 11
+[1] 12
+[1] 13
[1] TRUE
-[1] 10
-[1] 10
+[1] 14
+[1] 15
[1] TRUE
-[1] 10
-[1] 10
-[1] 10
-[1] 10
-[1] 10
-[1] 10
-[1] 10
-[1] 10
+[1] 16
+[1] 17
+[1] 18
+[1] 20
+[1] 21
+[1] 22
+[1] 23
+[1] 24
+[1] 25
+[1] 26
[1] "SUCCESS"
# 15:33:59 >
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list