This works if you have enabled debugging for a single command/function, and you are not aware how to exit the Browser prompt. To save you the trouble, popular Googles that ask you to f or Q or ESC or q() simply do not work. The behavior of debug command is identical in RStudio and the R prompt, at least in Windows 10 that i tested.

Here are two examples of enabling/disabling debug.

and, as expected, nothing happens until we try to run sapply again:
> sapply(split(mtcars$mpg, mtcars$cyl), mean)
debugging in: sapply(split(mtcars$mpg, mtcars$cyl), mean)
debug: {
FUN <- match.fun(FUN)
answer <- lapply(X = X, FUN = FUN, ...)
if (USE.NAMES && is.character(X) && is.null(names(answer)))
names(answer) <- X if (!isFALSE(simplify) && length(answer)) simplify2array(answer, higher = (simplify == "array")) else answer } Browse[2]>

There are two things to type here. The first is the command undebug(). In this case will be sapply. Then, Q exits the Browser prompt, and we can run the function outside of debug mode again. Let’s see:
Browse[2]> undebug(sapply)
Browse[2]> Q
> sapply(split(mtcars$mpg, mtcars$cyl), mean)
4 6 8
26.66364 19.74286 15.10000

Identically with ls()

ls(mtcars)
[1] "am" "carb" "cyl" "disp" "drat" "gear" "hp" "mpg" "qsec" "vs"
[11] "wt"
> debug(ls)
> ls(mtcars)
debugging in: ls(mtcars)
debug: {
if (!missing(name)) {
pos <- tryCatch(name, error = function(e) e)
if (inherits(pos, "error")) {
name <- substitute(name)
if (!is.character(name))
name <- deparse(name)
warning(gettextf("%s converted to character string",
sQuote(name)), domain = NA)
pos <- name
}
}
all.names <- .Internal(ls(envir, all.names, sorted))
if (!missing(pattern)) {
if ((ll <- length(grep("[", pattern, fixed = TRUE))) &&
ll != length(grep("]", pattern, fixed = TRUE))) {
if (pattern == "[") {
pattern <- "\\["
warning("replaced regular expression pattern '[' by '\\\\['")
}
else if (length(grep("[^\\\\]\\[<-", pattern))) {
pattern <- sub("\\[<-", "\\\\\\[<-",
pattern)
warning("replaced '[<-' by '\\\\[<-' in regular expression pattern") } } grep(pattern, all.names, value = TRUE) } else all.names }

This is a simple test case of creating a random 2×2 matrix, performing its inversion, and multiplying them. We will also use MS Excel to check our computations
Create a 2×2 matrix

> mNP <- matrix(rnorm(4),nrow=2,ncol=2)

This command used the matrix() function . This first argument, the datasets, uses rnorm() function to generate 4 random variates, and the next two arguments explain that those are to be ordered in a matrix of 2 rows by 2 columns. Now let’s display the matrix

Next, we use solve() function to invert the matrix, and display the output
> mNP_inv <- solve(mNP)
> mNP_inv
[,1] [,2]
[1,] 0.3360953 1.051306
[2,] -1.7260381 1.263961

Finally, we use the %*% operator to to the algebraic multiplication of the matrices and check if we arrive to I

> mNP %*% mNP_inv
[,1] [,2]
[1,] 1 0
[2,] 0 1
>

If you would want to do the last operation in Excel, as a check, then let’s suppose that the first matrix sits in fields A1,B1,A2,B2 and the second one sits in fields D1,E1,D2,E2. Their multiplication product would be:
Top left, top right =A1*D1+B1*D2 =A1*E1+B1*E2
Bottom left, bottom right =A2*D1+B2*D2 =A2*E1+B2*E2

Instead of creating the data frame programmatically, why not use an existing spreadsheet, available online. A simple HTTP file server, free and Open Source is HFS: http://rejetto.com/hfs/?f=
Once HFS is installed, uploading the spreadsheet is as simple as dragging and dropping an existing spreadsheet. Here is how it looks on my machine:

Once the file is in place, we can get its URL directly by right-clicking on the file, and selecting “Copy URL address – Ctrl+C”

The first time it will be needed to read the spreadsheet into R, some more software is needed

Download and install a PERL home on the machine. For Windows, Strawberry Perl can be used (link: http://strawberryperl.com/ )

Next, the package to read the spreadsheet needs to be installed into R. The package name is “gdata” so we perform

install.packages("gdata")
and require("gdata")

at this point, we are ready to load directly the spreadsheet into a new data frame

dfXLBAN <- read.xls("http://192.168.0.107/BaRanas.xlsx") trying URL 'http://192.168.0.107/BaRanas.xlsx' Content type 'application/octet-stream' length 8786 bytes downloaded 8786 bytes
lets display the data frame:

Since the spreadsheet contained one more row, we need (in order to have the dataframe exactly the same as our example with inline data) to discard the Date Column: dfB2 <- data.frame(dfXLBAN$Name,dfXLBAN$Bananas)

R is a procedural programming language, with built in statistical functions and the ability to generate graphical plots of data

Let’s install some software (all software below is Open Source License)

Use CRAN (Comprehensive R Archive Network) to download and install R. Go to CRAN https://cran.r-project.org/mirrors.html, select the mirror suitable for your geo location, and choose your platform. This will install R language itself

The one used here is how many bananas did 2 people eat, for one week (7 days). There is data for two people.

Launch RStudio

Observe the basic elements of the IDE: Script upper left, console below. Once the commands are executed, the values of the variables are displayed top-right. As seen in the screen to the left, there are 4 elements created, 2 vectors and 2 dataframes, and all assigned to variables. The two vectors contain our data (who ate how many bananas) and the dataframes are used for the plots. The first dataframe is used to determine the axis, the second to compute the statistical data.
Quick note, for those double-checking the numbers: the functions use N-1 instead of N as dividend, meaning they treat the data set as a sample, instead of a population. The mapping of the function names, between R and Excel for Variance is (EXCEL: VAR, R: VAR), and St.Dev (EXCEL:STDEV, R: SD)Excel, additionally, has functions VAR.P and STDEV.P where the dividend is N, providing a calculation that is considered to cover the entire dataset, and not a sample.

Now we need to install the graphics libraries to our installation and have them available for our code. For this, we need to type two commands. The first, connects to CRAN (so a Internet connection is required) to get the libraries.

Write our code and enter data

install.packages("ggplot2")
library(ggplot2)

Now let’s create some sample data. We will create a “data frame”, which will consist of two vectors, one holding the measurements (fruit consumed per day) and the second will contain the person linked to this measurement