[Rprotobuf-commits] r824 - papers/jss
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 23 01:08:03 CET 2014
Author: murray
Date: 2014-01-23 01:08:03 +0100 (Thu, 23 Jan 2014)
New Revision: 824
Modified:
papers/jss/article.Rnw
Log:
Improve the typesetting for the section 5 type coercion examples.
Modified: papers/jss/article.Rnw
===================================================================
--- papers/jss/article.Rnw 2014-01-22 23:39:33 UTC (rev 823)
+++ papers/jss/article.Rnw 2014-01-23 00:08:03 UTC (rev 824)
@@ -1157,15 +1157,18 @@
}
@
-<<>>=
-a <- new(protobuf_unittest.TestAllTypes)
-a$optional_bool <- TRUE
-a$optional_bool <- FALSE
-<<eval=FALSE>>=
-a$optional_bool <- NA
-<<echo=FALSE,eval=TRUE,print=TRUE>>=
-try(a$optional_bool <- NA,silent=TRUE)
-@
+% We want a cleaner error message here.
+\begin{CodeChunk}
+\begin{CodeInput}
+R> a <- new(protobuf_unittest.TestAllTypes)
+R> a$optional_bool <- TRUE
+R> a$optional_bool <- FALSE
+R> a$optional_bool <- NA
+\end{CodeInput}
+\begin{CodeOutput}
+Error: NA boolean values can not be stored in bool protocol buffer fields
+\end{CodeOutput}
+\end{CodeChunk}
\subsection{Unsigned Integers}
@@ -1175,11 +1178,7 @@
<<>>=
as.integer(2^31-1)
-<<eval=FALSE>>=
as.integer(2^31 - 1) + as.integer(1)
-<<echo=FALSE,eval=TRUE,print=TRUE>>=
-try(as.integer(2^31 - 1) + as.integer(1))
-
2^31
class(2^31)
@
@@ -1202,16 +1201,6 @@
RProtoBuf allows users to get and set 64-bit integer values by specifying
them as character strings.
-<<echo=FALSE,print=FALSE>>=
-if (!exists("protobuf_unittest.TestAllTypes",
- "RProtoBuf:DescriptorPool")) {
- unittest.proto.file <- system.file("unitTests", "data",
- "unittest.proto",
- package="RProtoBuf")
- readProtoFiles(file=unittest.proto.file)
-}
-@
-
If we try to set an int64 field in R to double values, we lose
precision:
More information about the Rprotobuf-commits
mailing list