diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Split.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Split.java index 63527e6a2b8ddf80325dab67f2cf0742633bd41f..0069d9e8851782c95f4c4ac00845a5c264c49550 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Split.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Split.java @@ -43,6 +43,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractListVector; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; +import com.oracle.truffle.r.runtime.data.model.RAbstractVector; /** * The {@code split} internal. Internal version of 'split' is invoked from 'split.default' function @@ -58,7 +59,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; public abstract class Split extends RBuiltinNode.Arg2 { @Child private RFactorNodes.GetLevels getLevelNode = new RFactorNodes.GetLevels(); - @Child private GetNamesAttributeNode getNames = GetNamesAttributeNode.create(); + @Child private GetNamesAttributeNode getNamesNode = GetNamesAttributeNode.create(); @SuppressWarnings("unused") private final ConditionProfile noStringLevels = ConditionProfile.createBinaryProfile(); private final ConditionProfile namesProfile = ConditionProfile.createBinaryProfile(); @@ -94,12 +95,12 @@ public abstract class Split extends RBuiltinNode.Arg2 { collect[collectResultSize[resultIndex]++] = x.getDataAt(i); } - // assemble result vectors and level names Object[] results = new Object[nLevels]; + RStringVector[] resultNames = getNames(x, factor, nLevels, collectResultSize); for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createList(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i])); + results[i] = RDataFactory.createList(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), + (resultNames != null) ? resultNames[i] : null); } - return RDataFactory.createList(results, names); } @@ -128,28 +129,11 @@ public abstract class Split extends RBuiltinNode.Arg2 { } Object[] results = new Object[nLevels]; - RStringVector xNames = getNames.getNames(x); - if (namesProfile.profile(xNames != null)) { - String[][] resultNames = new String[nLevels][]; - int[] resultNamesIdxs = new int[nLevels]; - for (int i = 0; i < nLevels; i++) { - resultNames[i] = new String[collectResultSize[i]]; - } - for (int i = 0, fi = 0; i < x.getLength(); ++i, fi = Utils.incMod(fi, factor.length)) { - int resultIndex = factor[fi] - 1; // a factor is a 1-based int vector - resultNames[resultIndex][resultNamesIdxs[resultIndex]++] = xNames.getDataAt(i); - } - for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createIntVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), x.isComplete(), - RDataFactory.createStringVector(resultNames[i], xNames.isComplete())); - } - } else { - // assemble result vectors and level names - for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createIntVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), x.isComplete()); - } + RStringVector[] resultNames = getNames(x, factor, nLevels, collectResultSize); + for (int i = 0; i < nLevels; i++) { + results[i] = RDataFactory.createIntVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), x.isComplete(), + (resultNames != null) ? resultNames[i] : null); } - return RDataFactory.createList(results, names); } @@ -177,12 +161,12 @@ public abstract class Split extends RBuiltinNode.Arg2 { collect[collectResultSize[resultIndex]++] = x.getDataAt(i); } - // assemble result vectors and level names Object[] results = new Object[nLevels]; + RStringVector[] resultNames = getNames(x, factor, nLevels, collectResultSize); for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createDoubleVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), RDataFactory.COMPLETE_VECTOR); + results[i] = RDataFactory.createDoubleVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), RDataFactory.COMPLETE_VECTOR, + (resultNames != null) ? resultNames[i] : null); } - return RDataFactory.createList(results, names); } @@ -210,12 +194,12 @@ public abstract class Split extends RBuiltinNode.Arg2 { collect[collectResultSize[resultIndex]++] = x.getDataAt(i); } - // assemble result vectors and level names Object[] results = new Object[nLevels]; + RStringVector[] resultNames = getNames(x, factor, nLevels, collectResultSize); for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createStringVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), RDataFactory.COMPLETE_VECTOR); + results[i] = RDataFactory.createStringVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), RDataFactory.COMPLETE_VECTOR, + (resultNames != null) ? resultNames[i] : null); } - return RDataFactory.createList(results, names); } @@ -243,12 +227,12 @@ public abstract class Split extends RBuiltinNode.Arg2 { collect[collectResultSize[resultIndex]++] = x.getDataAt(i); } - // assemble result vectors and level names Object[] results = new Object[nLevels]; + RStringVector[] resultNames = getNames(x, factor, nLevels, collectResultSize); for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createLogicalVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), x.isComplete()); + results[i] = RDataFactory.createLogicalVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), x.isComplete(), + (resultNames != null) ? resultNames[i] : null); } - return RDataFactory.createList(results, names); } @@ -276,15 +260,36 @@ public abstract class Split extends RBuiltinNode.Arg2 { collect[collectResultSize[resultIndex]++] = x.getDataAt(i).getValue(); } - // assemble result vectors and level names Object[] results = new Object[nLevels]; + RStringVector[] resultNames = getNames(x, factor, nLevels, collectResultSize); for (int i = 0; i < nLevels; i++) { - results[i] = RDataFactory.createRawVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i])); + results[i] = RDataFactory.createRawVector(Arrays.copyOfRange(collectResults[i], 0, collectResultSize[i]), + (resultNames != null) ? resultNames[i] : null); } - return RDataFactory.createList(results, names); } + private RStringVector[] getNames(RAbstractVector x, int[] factor, int nLevels, int[] collectResultSize) { + RStringVector xNames = getNamesNode.getNames(x); + if (namesProfile.profile(xNames != null)) { + String[][] namesArr = new String[nLevels][]; + int[] resultNamesIdxs = new int[nLevels]; + for (int i = 0; i < nLevels; i++) { + namesArr[i] = new String[collectResultSize[i]]; + } + for (int i = 0, fi = 0; i < x.getLength(); ++i, fi = Utils.incMod(fi, factor.length)) { + int resultIndex = factor[fi] - 1; // a factor is a 1-based int vector + namesArr[resultIndex][resultNamesIdxs[resultIndex]++] = xNames.getDataAt(i); + } + RStringVector[] resultNames = new RStringVector[nLevels]; + for (int i = 0; i < nLevels; i++) { + resultNames[i] = RDataFactory.createStringVector(namesArr[i], xNames.isComplete()); + } + return resultNames; + } + return null; + } + private static int getNLevels(RStringVector levels) { return levels != null ? levels.getLength() : 0; } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index fed424a0076766d9532b3acf99d78fd3069e910a..ff7cb7b48b5e5e9b5c5434b6bd4a9223e4aba6ec 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -64847,7 +64847,7 @@ $`1` #argv <- list(character(0), structure(integer(0), .Label = character(0), class = 'factor')); .Internal(split(argv[[1]], argv[[2]])) named list() -##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit16#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit16# #argv <- list(structure(c(47.432, 12.482), .Names = c('(Intercept)', 'group2')), structure(1:2, .Label = c('0', '1'), class = 'factor')); .Internal(split(argv[[1]], argv[[2]])) $`0` (Intercept) @@ -64993,7 +64993,7 @@ $`41` [1] 0.1158763 -##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit2#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit2# #argv <- list(structure(c(-1.13864415195445, 0.574433648632919, 0.61125743366192, 0.291104607198021, 1.44367450704693, 0.408616385050392, -0.252815027721455, 0.73544465026571, -0.711029326417947, -0.611820918993561, -0.963259276248408, -0.28935033673839, -0.482346616963731, 0.575284398820533, 0.0664802498883062, 0.0889008730409177, -0.527009741835806, -0.572160487726669, 0.458433701366337, 0.0259549922279207, 0.79246010222197, 0.200856719794408, 0.681708382019133, 1.24959713166139, 2.28504683598586, 0.885201117877485, 0.275047494865858, 0.0611635446204713, -0.226340664609402, -0.701634984067551, -1.36331112409512, -0.470720710127998, 0.0116712292760789, 0.680960771805182, 1.25010637890252, -0.168484448953506, -0.703880448859559, -0.342493773069341, -0.359950801091045, 0.187018301421814, 0.332611568778467, 0.418088885897922, 1.52526747601546, 1.23881025318897, 1.97893910443604, 1.67980257496383, -0.0423836378777035, -0.085940264442189, 0.0751591419566941, 1.33615888669544, 1.29143414265875, 0.211686019646981, 0.107754613497605, -0.842122877395922, -0.363550334633855, -1.04260396788242, -1.00216202750311, -0.725219786582336, -0.702075395338802, -0.0588517433215815, 0.676181221812652, 0.606054389584641, -0.0722001122493283, -0.565579974058951, -1.50420998542363, -1.38835023347894, -1.6387526999868, -1.22317617387598, -2.6439685322602, -1.50311594814139, 0.58539278534518, 0.476423420506994, -0.229810354321508, -0.669629539423225, -0.500767918117353, -1.30780681405878, -0.0658147956438969, 0.619743292251259, 0.947409254626009, 0.137968713284014, -0.0705143536229389, -0.316245167388448, 0.423768217540825, -1.77132723836955, 0.437524374017483, 1.05217040293853, 1.29145821945076, 0.189519814277623, 0.405463210651828, -1.10579240546022, 0.470126971026959, 1.3013241742778, 1.57690948154138, 0.836753145709701, -0.0990436481848584, 0.305059193206195, 0.722542224965483, 0.497020187014643, -0.798519685959293, -0.162044448918511, -0.268976403560686, 0.471344909208507, 1.07960447064393, 0.816448434674936, 1.01857006703316, -0.19352270657549, 0.193745914189151, -0.0118346974247015, 0.515110447770272, 1.29117007883295, 0.484844437955959, 0.357506193819553, -1.95817055695569, -1.62102859205691, -2.13900473718215, -2.19173201733318, -1.86372596557808, -1.18864210270607, -1.19890597040604, 0.432503235072499, 0.594410727524479, 1.21432538936706, 2.15795981275539, 1.31528364302187, 0.38422055227912, 0.786869292659675, -0.703717985086569, -0.535651668024763, 0.34627858116184, 0.537117318247469, 0.901014803953916, 1.2151594352426, 0.827351473348557, -0.682186392255085, -1.33342351753519, -1.26893821314864, -1.4632463728941, -1.64736130434257, -1.21073183651285, -0.643396605364174), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '140')), structure(c(9L, 9L, 9L, 9L, 9L, 9L, 9L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 12L, 12L, 12L, 12L, 12L, 12L, 12L), .Label = c('10', '8', '2', '6', '3', '5', '9', '7', '1', '4', '17', '20', '11', '12', '16', '13', '14', '18', '15', '19'), class = c('ordered', 'factor'))); .Internal(split(argv[[1]], argv[[2]])) $`10` 64 65 66 67 68 69 70 @@ -65099,7 +65099,18 @@ b d 2 4 -##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit3#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit2# +#{ .Internal(split(structure(c(TRUE,FALSE,FALSE,FALSE), names=c('a','b','c','d')), factor(c(1,2)))); } +$`1` + a c + TRUE FALSE + +$`2` + b d +FALSE FALSE + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_split.testsplit3# #argv <- list(structure(c(1034.46153846154, 480.076923076923, 504.692307692308, 480.076923076923, 0, 0, 0, 0, 480.076923076923, 517.230769230769, 444.307692307692, 819.846153846154, 945.230769230769, 542.769230769231, 0, 0, 0, 1824.30769230769, 444.307692307692, 912.153846153846, 0, 0, 1514.07692307692, 0, 936, 0), .Dim = 26L, .Dimnames = list(c('1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'))), structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c('1', '2'), class = 'factor')); .Internal(split(argv[[1]], argv[[2]])) $`1` 1 1 1 1 1 1 1 1 diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_split.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_split.java index db9e327f9ab09a50f734340d4e225217da8b12b5..57f77f394a6a1379bfe851d67699523664e0350c 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_split.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_split.java @@ -25,17 +25,13 @@ public class TestBuiltin_split extends TestBase { @Test public void testsplit2() { assertEval("{ .Internal(split(structure(1:4, names=c('a','b','c','d')), factor(c(1,2)))); }"); - // FIXME FastR does not output the explicitly given .Label - // Although docs do not explicitly require that it's expectable - assertEval(Ignored.OutputFormatting, - "argv <- list(structure(c(-1.13864415195445, 0.574433648632919, 0.61125743366192, 0.291104607198021, 1.44367450704693, 0.408616385050392, -0.252815027721455, 0.73544465026571, -0.711029326417947, -0.611820918993561, -0.963259276248408, -0.28935033673839, -0.482346616963731, 0.575284398820533, 0.0664802498883062, 0.0889008730409177, -0.527009741835806, -0.572160487726669, 0.458433701366337, 0.0259549922279207, 0.79246010222197, 0.200856719794408, 0.681708382019133, 1.24959713166139, 2.28504683598586, 0.885201117877485, 0.275047494865858, 0.0611635446204713, -0.226340664609402, -0.701634984067551, -1.36331112409512, -0.470720710127998, 0.0116712292760789, 0.680960771805182, 1.25010637890252, -0.168484448953506, -0.703880448859559, -0.342493773069341, -0.359950801091045, 0.187018301421814, 0.332611568778467, 0.418088885897922, 1.52526747601546, 1.23881025318897, 1.97893910443604, 1.67980257496383, -0.0423836378777035, -0.085940264442189, 0.0751591419566941, 1.33615888669544, 1.29143414265875, 0.211686019646981, 0.107754613497605, -0.842122877395922, -0.363550334633855, -1.04260396788242, -1.00216202750311, -0.725219786582336, -0.702075395338802, -0.0588517433215815, 0.676181221812652, 0.606054389584641, -0.0722001122493283, -0.565579974058951, -1.50420998542363, -1.38835023347894, -1.6387526999868, -1.22317617387598, -2.6439685322602, -1.50311594814139, 0.58539278534518, 0.476423420506994, -0.229810354321508, -0.669629539423225, -0.500767918117353, -1.30780681405878, -0.0658147956438969, 0.619743292251259, 0.947409254626009, 0.137968713284014, -0.0705143536229389, -0.316245167388448, 0.423768217540825, -1.77132723836955, 0.437524374017483, 1.05217040293853, 1.29145821945076, 0.189519814277623, 0.405463210651828, -1.10579240546022, 0.470126971026959, 1.3013241742778, 1.57690948154138, 0.836753145709701, -0.0990436481848584, 0.305059193206195, 0.722542224965483, 0.497020187014643, -0.798519685959293, -0.162044448918511, -0.268976403560686, 0.471344909208507, 1.07960447064393, 0.816448434674936, 1.01857006703316, -0.19352270657549, 0.193745914189151, -0.0118346974247015, 0.515110447770272, 1.29117007883295, 0.484844437955959, 0.357506193819553, -1.95817055695569, -1.62102859205691, -2.13900473718215, -2.19173201733318, -1.86372596557808, -1.18864210270607, -1.19890597040604, 0.432503235072499, 0.594410727524479, 1.21432538936706, 2.15795981275539, 1.31528364302187, 0.38422055227912, 0.786869292659675, -0.703717985086569, -0.535651668024763, 0.34627858116184, 0.537117318247469, 0.901014803953916, 1.2151594352426, 0.827351473348557, -0.682186392255085, -1.33342351753519, -1.26893821314864, -1.4632463728941, -1.64736130434257, -1.21073183651285, -0.643396605364174), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '140')), structure(c(9L, 9L, 9L, 9L, 9L, 9L, 9L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 12L, 12L, 12L, 12L, 12L, 12L, 12L), .Label = c('10', '8', '2', '6', '3', '5', '9', '7', '1', '4', '17', '20', '11', '12', '16', '13', '14', '18', '15', '19'), class = c('ordered', 'factor'))); .Internal(split(argv[[1]], argv[[2]]))"); + assertEval("{ .Internal(split(structure(c(TRUE,FALSE,FALSE,FALSE), names=c('a','b','c','d')), factor(c(1,2)))); }"); + assertEval("argv <- list(structure(c(-1.13864415195445, 0.574433648632919, 0.61125743366192, 0.291104607198021, 1.44367450704693, 0.408616385050392, -0.252815027721455, 0.73544465026571, -0.711029326417947, -0.611820918993561, -0.963259276248408, -0.28935033673839, -0.482346616963731, 0.575284398820533, 0.0664802498883062, 0.0889008730409177, -0.527009741835806, -0.572160487726669, 0.458433701366337, 0.0259549922279207, 0.79246010222197, 0.200856719794408, 0.681708382019133, 1.24959713166139, 2.28504683598586, 0.885201117877485, 0.275047494865858, 0.0611635446204713, -0.226340664609402, -0.701634984067551, -1.36331112409512, -0.470720710127998, 0.0116712292760789, 0.680960771805182, 1.25010637890252, -0.168484448953506, -0.703880448859559, -0.342493773069341, -0.359950801091045, 0.187018301421814, 0.332611568778467, 0.418088885897922, 1.52526747601546, 1.23881025318897, 1.97893910443604, 1.67980257496383, -0.0423836378777035, -0.085940264442189, 0.0751591419566941, 1.33615888669544, 1.29143414265875, 0.211686019646981, 0.107754613497605, -0.842122877395922, -0.363550334633855, -1.04260396788242, -1.00216202750311, -0.725219786582336, -0.702075395338802, -0.0588517433215815, 0.676181221812652, 0.606054389584641, -0.0722001122493283, -0.565579974058951, -1.50420998542363, -1.38835023347894, -1.6387526999868, -1.22317617387598, -2.6439685322602, -1.50311594814139, 0.58539278534518, 0.476423420506994, -0.229810354321508, -0.669629539423225, -0.500767918117353, -1.30780681405878, -0.0658147956438969, 0.619743292251259, 0.947409254626009, 0.137968713284014, -0.0705143536229389, -0.316245167388448, 0.423768217540825, -1.77132723836955, 0.437524374017483, 1.05217040293853, 1.29145821945076, 0.189519814277623, 0.405463210651828, -1.10579240546022, 0.470126971026959, 1.3013241742778, 1.57690948154138, 0.836753145709701, -0.0990436481848584, 0.305059193206195, 0.722542224965483, 0.497020187014643, -0.798519685959293, -0.162044448918511, -0.268976403560686, 0.471344909208507, 1.07960447064393, 0.816448434674936, 1.01857006703316, -0.19352270657549, 0.193745914189151, -0.0118346974247015, 0.515110447770272, 1.29117007883295, 0.484844437955959, 0.357506193819553, -1.95817055695569, -1.62102859205691, -2.13900473718215, -2.19173201733318, -1.86372596557808, -1.18864210270607, -1.19890597040604, 0.432503235072499, 0.594410727524479, 1.21432538936706, 2.15795981275539, 1.31528364302187, 0.38422055227912, 0.786869292659675, -0.703717985086569, -0.535651668024763, 0.34627858116184, 0.537117318247469, 0.901014803953916, 1.2151594352426, 0.827351473348557, -0.682186392255085, -1.33342351753519, -1.26893821314864, -1.4632463728941, -1.64736130434257, -1.21073183651285, -0.643396605364174), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129', '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '140')), structure(c(9L, 9L, 9L, 9L, 9L, 9L, 9L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 12L, 12L, 12L, 12L, 12L, 12L, 12L), .Label = c('10', '8', '2', '6', '3', '5', '9', '7', '1', '4', '17', '20', '11', '12', '16', '13', '14', '18', '15', '19'), class = c('ordered', 'factor'))); .Internal(split(argv[[1]], argv[[2]]))"); } @Test public void testsplit3() { - // FIXME .Label needs to be fixed - assertEval(Ignored.OutputFormatting, - "argv <- list(structure(c(1034.46153846154, 480.076923076923, 504.692307692308, 480.076923076923, 0, 0, 0, 0, 480.076923076923, 517.230769230769, 444.307692307692, 819.846153846154, 945.230769230769, 542.769230769231, 0, 0, 0, 1824.30769230769, 444.307692307692, 912.153846153846, 0, 0, 1514.07692307692, 0, 936, 0), .Dim = 26L, .Dimnames = list(c('1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'))), structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c('1', '2'), class = 'factor')); .Internal(split(argv[[1]], argv[[2]]))"); + assertEval("argv <- list(structure(c(1034.46153846154, 480.076923076923, 504.692307692308, 480.076923076923, 0, 0, 0, 0, 480.076923076923, 517.230769230769, 444.307692307692, 819.846153846154, 945.230769230769, 542.769230769231, 0, 0, 0, 1824.30769230769, 444.307692307692, 912.153846153846, 0, 0, 1514.07692307692, 0, 936, 0), .Dim = 26L, .Dimnames = list(c('1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'))), structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c('1', '2'), class = 'factor')); .Internal(split(argv[[1]], argv[[2]]))"); } @Test @@ -93,10 +89,7 @@ public class TestBuiltin_split extends TestBase { @Test public void testsplit16() { - // FIXME FastR does not output the explicitly given .Label - // Although docs do not explicitly require that it's expectable - assertEval(Ignored.OutputFormatting, - "argv <- list(structure(c(47.432, 12.482), .Names = c('(Intercept)', 'group2')), structure(1:2, .Label = c('0', '1'), class = 'factor')); .Internal(split(argv[[1]], argv[[2]]))"); + assertEval("argv <- list(structure(c(47.432, 12.482), .Names = c('(Intercept)', 'group2')), structure(1:2, .Label = c('0', '1'), class = 'factor')); .Internal(split(argv[[1]], argv[[2]]))"); } @Test