# NOT RUN {
endp <- table_endpoint("https://mycosmosdb.table.cosmos.azure.com:443", key="mykey")
tab <- create_storage_table(endp, "mytable")
## a simple batch insert
ir <- subset(iris, Species == "setosa")
# property names must be valid C# variable names
names(ir) <- sub("\\.", "_", names(ir))
# create the PartitionKey and RowKey properties
ir$PartitionKey <- ir$Species
ir$RowKey <- sprintf("%03d", seq_len(nrow(ir)))
# generate the array of insert operations: 1 per row
ops <- lapply(seq_len(nrow(ir)), function(i)
create_table_operation(endp, "mytable", body=ir[i, ], http_verb="POST")))
# create a batch transaction and send it to the endpoint
bat <- create_batch_transaction(endp, ops)
do_batch_transaction(bat)
# }
Run the code above in your browser using DataLab