# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Get numeric vector from python __main__ namespace.
#'
#' The data retrieved from Python has to be a list of numbers.
#'
#' @param name Python variable name
#'
#' @export
numvec_to_R <- function(name) {
.Call('Rpyplot_numvec_to_R', PACKAGE = 'Rpyplot', name)
}
#' Copy list of strings from Python to R character vector
#'
#' @examples
#'
#'pyrun("l = ['a', 'b']")
#'pyrun("print(l)")
#'charvec_to_R("l")
#'pyrun("l2 = [u'a', u'b']")
#'charvec_to_R("l2")
charvec_to_R <- function(name) {
.Call('Rpyplot_charvec_to_R', PACKAGE = 'Rpyplot', name)
}
char_to_R <- function(name) {
.Call('Rpyplot_char_to_R', PACKAGE = 'Rpyplot', name)
}
num_to_R <- function(name) {
.Call('Rpyplot_num_to_R', PACKAGE = 'Rpyplot', name)
}
#' Run python code
#'
#' Runs Python code in namespace __main__ .
#'
#' @param command Python code to execute as string
#' @examples
#' pyrun("print(range(5))")
#' @export
pyrun <- function(command) {
invisible(.Call('Rpyplot_pyrun', PACKAGE = 'Rpyplot', command))
}
initialize_python <- function() {
invisible(.Call('Rpyplot_initialize_python', PACKAGE = 'Rpyplot'))
}
finalize_python <- function() {
invisible(.Call('Rpyplot_finalize_python', PACKAGE = 'Rpyplot'))
}
#' Push data to python __main__ namespace
#'
#' @param name Python variable name as string
#' @param x Numeric vector to copy to Python
#'
#' @examples
#' numvec_to_python("l", 1:10)
#' pyrun("print l")
#'
topy.numeric <- function(x, name) {
invisible(.Call('Rpyplot_numvec_to_python', PACKAGE = 'Rpyplot', x, name))
}
topy.character <- function(strings, name) {
invisible(.Call('Rpyplot_charvec_to_python', PACKAGE = 'Rpyplot', strings, name))
}
pydict.numeric <- function(x, name, dictname) {
invisible(.Call('Rpyplot_num_to_dict', PACKAGE = 'Rpyplot', x, name, dictname))
}
pydict.character <- function(x, name, dictname) {
invisible(.Call('Rpyplot_char_to_dict', PACKAGE = 'Rpyplot', x, name, dictname))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.