<jupyter_start><jupyter_text>Simple tests for an R kernelThis shows basic R manipulation. No access to Spark yet.  Data manipulation<jupyter_code>num = 200

# Create a normal variable
a = 1:num
b = rnorm(num,6)

# Another vector, by mixing from two random variables
c1 = c( rnorm(num/2,5,3),  rnorm(num/2,9,4) )
c2 = as.factor( c( rep('A',num/2), rep('B',num/2) ) )
c = data.frame( dvalue2=c1, vtype=c2 )

c = c[ sample(num), ]
summary(c)
exdf = data.frame( dnum=a, dvalue1=b )
exdf <- cbind( exdf, c )
class(exdf)
head(exdf)
summary(exdf)<jupyter_output><empty_output><jupyter_text>Graphics<jupyter_code># Load the ggplot graphics library
library('ggplot2')

# A density plot
qplot( dvalue1, data=exdf, geom="density" )
# Change default plot size (values in inches)
options(repr.plot.width = 10, repr.plot.height = 5)

# A scatterplot, discriminating by the factor in the 'vtype' column
qplot( dvalue1, dvalue2, color=vtype, data=exdf )<jupyter_output><empty_output><jupyter_text>DocumentationThe IRKernel has also autocompletion (use `TAB`). It does also have contextual helps (tooltips), use `shift-TAB` on a R keyword for it.It provides also full acccess to R documentation:<jupyter_code>?Lognormal<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12581168831168832, 'fraction_numerical': 0.021103896103896104, 'mean_word_length': 5.926966292134831, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '468818', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 472, 'n_tokens_neox': 455, 'n_words': 130, 'path': 'vmfiles/IPNB/Examples/e R/01 R basics.ipynb', 'repo_name': 'paulovn/ml-vm-notebook', 'size': '1232'}