The R Project SVN R-packages

Rev

Rev 3458 | Rev 3473 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3458 Rev 3471
Line 73... Line 73...
73
          all(names(iris.sdf) == names(iris)))
73
          all(names(iris.sdf) == names(iris)))
74
 
74
 
75
# test sdf indexers
75
# test sdf indexers
76
compareSdfToDf(iris.sdf, iris)
76
compareSdfToDf(iris.sdf, iris)
77
#compareSdfToDf(u2.sdf, attenu) # problem with factors
77
#compareSdfToDf(u2.sdf, attenu) # problem with factors
-
 
78
stopifnot(all.equal(unlist(iris.sdf),unlist(iris.sdf[])),
-
 
79
          all.equal(unlist(iris.sdf),unlist(iris.sdf[,])))
-
 
80
tmp <- iris.sdf[1]
-
 
81
stopifnot(nrow(tmp) == nrow(iris.sdf),
-
 
82
          names(tmp) == names(iris.sdf)[1],
-
 
83
          all.equal(tmp[,1], iris.sdf[,1]))
-
 
84
 
78
 
85
 
79
# test operators
86
# test operators
80
stopifnot(all.equal(iris.sdf[,1] + iris.sdf[,2], iris[,1] + iris[,2]))
87
stopifnot(all.equal(iris.sdf[,1] + iris.sdf[,2], iris[,1] + iris[,2]),
81
stopifnot(all.equal(iris.sdf[,1]*10 %/% iris.sdf[,2],iris[,1]*10 %/% iris[,2]))
88
          all.equal(iris.sdf[,1]*10 %/% iris.sdf[,2],iris[,1]*10 %/% iris[,2]),
82
stopifnot(all.equal(signif(log(iris.sdf[,1],17)), signif(log(iris[,1],17))))
89
          all.equal(signif(log(iris.sdf[,1],17)), signif(log(iris[,1],17))),
83
stopifnot(all.equal(round(log(iris.sdf[,1]),5), round(log(iris[,1]),5)))
90
          all.equal(round(log(iris.sdf[,1]),5), round(log(iris[,1]),5)),
84
stopifnot(all.equal(with(iris.sdf, Sepal.Length*Sepal.Width - Petal.Length/Petal.Width), with(iris, Sepal.Length*Sepal.Width - Petal.Length/Petal.Width)))
91
          all.equal(with(iris.sdf, Sepal.Length*Sepal.Width - Petal.Length/Petal.Width), 
-
 
92
                    with(iris, Sepal.Length*Sepal.Width - Petal.Length/Petal.Width)),
-
 
93
          all.equal(sort(iris.sdf[,2]), sort(iris[,2])),
-
 
94
          all.equal(quantile(iris.sdf[,3]), quantile(iris[,3])))
85
 
95
 
86
stopifnot(sapply(iris.sdf[,1:4],sum) == sapply(iris[,1:4],sum))
96
stopifnot(sapply(iris.sdf[,1:4],sum) == sapply(iris[,1:4],sum))
87
 
97
 
88
#if (require(RSQLite)) {
98
#if (require(RSQLite)) {
89
#    dr <- SQLite()
99
#    dr <- SQLite()