mongo.bson.buffer.append.long(rmongodb)
mongo.bson.buffer.append.long()所属R语言包:rmongodb
Append a long valued field onto a mongo.bson.buffer
附加一个长值字段到一个mongo.bson.buffer上
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Append a long value or vector of longs onto a mongo.bson.buffer.
附加一个长整型值或向量的多头到mongo.bson.buffer。
Note that since R has no long (64-bit integer) type, doubles are used in R, but are converted to 64-bit values when stored in the buffer; some loss of precision may occur.
请注意,由于R具有没有长(64位整数)的类型,双打用于在R,但被转换为64位的值,当存储在缓冲器中;一些精度损失,可能会发生。
This is the only case in which mongo.bson.buffer.append() cannot make the proper guess about what type to encode into the buffer.<br> You must call mongo.bson.buffer.append.long() explicitly; otherwise, doubles are appended.
这是唯一的情况下mongo.bson.buffer.append()不能做出正确的猜测什么类型的编码到缓冲区。<br>您必须调用“mongo.bson.buffer.append.long()明确,否则,双打附加。
用法----------Usage----------
mongo.bson.buffer.append.long(buf, name, value)
参数----------Arguments----------
参数:buf
(mongo.bson.buffer) The buffer object to which to append.
(mongo.bson.buffer)缓冲器,附加的对象。
参数:name
(string) The name (key) of the field appended to the buffer.
(字符串)名称(键)的字段附加到缓冲区。
参数:value
(double vector) The values(s) to append to the buffer. If value has a dims attribute of length > 1, any names or dimnames attribute is ignored and a nested array is appended.<br> (Use mongo.bson.buffer.append.object() if you want to preserve dimnames; however, this can't append value as longs). If value has a names attribute, a subobject is appended and the subfields are given the indicated names. Otherwise, if more than one element is present in value, the values are appended as a subarray. In the last case, a single long is appended as the value of the field.
(双矢量)的值(S)附加到缓冲区。如果值有dims属性的长度> 1,任何names或dimnames属性被忽略,并且附加一个嵌套数组。<BR>(使用mongo.bson.buffer.append.object(),如果你希望保留dimnames,但是,这不能附加价值作为多头)。如果值有一个名称属性,追加一个子对象的子场指定的名称。否则,如果多个元素存在的价值,追加为一个子数组的值。在最后一种情况下,一个单一的长所附的值的字段。
值----------Value----------
TRUE if successful; otherwise, FALSE if an error occured appending the data.
TRUE,如果成功,否则,FALSE,如果发生了错误,附加数据。
参见----------See Also----------
mongo.bson,<br> mongo.bson.buffer,<br> mongo.bson.buffer.append.<br>
mongo.bson,参考mongo.bson.buffer,参考mongo.bson.buffer.append。<BR>
实例----------Examples----------
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.long(buf, "YearSeconds",
365.24219 * 24 * 60 * 60)
b <- mongo.bson.from.buffer(buf)
# The above produces a BSON object of the form:[上面产生的BSON对象的形式:]
# { "YearSeconds" : 31556925 }[{的“YearSeconds”:31556925}]
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.long(buf, "longs",
c(1, 9087654321, 1234567809))
b <- mongo.bson.from.buffer(buf)
# The above produces a BSON object of the form:[上面产生的BSON对象的形式:]
# { "longs" : [1, 9087654321, 1234567809] }[{“多头”:[1,9087654321,1234567809]]
buf <- mongo.bson.buffer.create()
distances <- c(473, 133871000, 188178313)
names(distances) <- c("Sol", "Proxima Centari", "Bernard's Star")
mongo.bson.buffer.append.long(buf, "Stars", distances)
b <- mongo.bson.from.buffer(buf)
# The above produces a BSON object of the form:[上面产生的BSON对象的形式:]
# { "Stars" : { "Sol" : 474,[{“明星”:{“索尔”:474,]
# "Proxima Centari" : 133871000, [“比邻CENTARI”的:133871000,]
# "Bernard's Star" : 188178313 } }[“伯纳德之星”:188178313}}]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|