<jupyter_start><jupyter_text>Load WorkspaceThe following cell will read the workspace configuration from aml_config/config.jsonMake sure to place the config.json file containing your workspace configuration there -- see here for details.<jupyter_code>from azureml.core import Workspace
ws = Workspace.from_config()<jupyter_output>Found the config file in: /Users/danielsc/git/azureml-and-r/aml_config/config.json<jupyter_text>Create and Experiment<jupyter_code>from azureml.core import Experiment

experiment = Experiment(ws, 'testing-R')<jupyter_output><empty_output><jupyter_text>The R fileThere is an R file in this folder which just loads some data and creates a plot. The next cell will show the file, so you can inspect it. The script writes a pdf to the `outputs` folder -- that file is uploaded to the run history after the run completes.In order to log data to AML you need the azureml Run object. Since that lives in python, we are using reticulate to spin up a python environment where we can create/fetch it. **Note that currently, due to [this bug](https://msdata.visualstudio.com/Vienna/_workitems/edit/380162), the connection needs to be explitly flushed at the end. Also, jobs that run longer than 1 hour could experience issues logging metrics.**<jupyter_code>!pygmentize test.R
target = ws.compute_targets['aml-compute']
from azureml.train.estimator import Estimator

estwithr = Estimator(source_directory='.', 
                     conda_packages=['r-essentials', 'mro-base', 'r-reticulate'],
                    compute_target=target, 
                    entry_script='launchR.py', 
                     script_params={'test.R': ''})

runwithr = experiment.submit(estwithr)
runwithr
from azureml.widgets import RunDetails
RunDetails(runwithr).show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08166666666666667, 'fraction_numerical': 0.0038888888888888888, 'mean_word_length': 4.507645259938838, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '363349', 'license': 'MIT', 'n_tokens_mistral': 533, 'n_tokens_neox': 508, 'n_words': 180, 'path': 'RunRJobs.ipynb', 'repo_name': 'dcstwh/azureml-and-r', 'size': '1800'}