Title: | RStudio Addin for Teaching and Learning Data Manipulation Using 'dplyr' |
---|---|
Description: | An RStudio addin for teaching and learning data manipulation using the 'dplyr' package. You can learn each steps of data manipulation by clicking your mouse without coding. You can get resultant data (as a 'tibble') and the code for data manipulation. |
Authors: | Keon-Woong Moon [aut, cre] |
Maintainer: | Keon-Woong Moon <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1 |
Built: | 2025-01-28 03:54:47 UTC |
Source: | https://github.com/cardiomoon/dplyrassist |
Check the validity of code
checkInvalid(temp)
checkInvalid(temp)
temp |
A character string to check validity |
The position of the first invalid code or NULL
checkInvalid(c("iris","irisssss"))
checkInvalid(c("iris","irisssss"))
Differentiate the R code
codes2kind(vcodes)
codes2kind(vcodes)
vcodes |
A character vector to differentiate |
A character vector indicating whether the code returns text or plot
require(tidyverse) temp <-c("iris %>% group_by(Species) %>% summarize_all(mean)","table1") codes2kind(temp)
require(tidyverse) temp <-c("iris %>% group_by(Species) %>% summarize_all(mean)","table1") codes2kind(temp)
Interactively manipulate a data.frame
or a tibble
. The resulting
code will be emitted as an R code.
dplyrAssist(df = NULL, right = NULL)
dplyrAssist(df = NULL, right = NULL)
df |
A tibble or a tbl_df or a data.frame to manipulate |
right |
Optional second data(A tibble or a tbl_df or a data.frame) to join |
This addin can be used to interactively manipulate a data.frame
or a tibble
using dplyr.
The intended way to use this is as follows:
1. Highlight a symbol naming a data.frame
or a tibble
in your R session,
e.g. mtcars
,
2. Execute this addin, to interactively manipulate it.
When you're done, the code for data manipulation will be emitted at the cursor position.
A manipulated tibble or NULL
library(tidyverse) library(nycflights13) ## Not run: dplyrAssist(band_members,band_instruments) dplyrAssist(flights) result<-dplyrAssist(iris) cat(attr(result,"code")) ## End(Not run)
library(tidyverse) library(nycflights13) ## Not run: dplyrAssist(band_members,band_instruments) dplyrAssist(flights) result<-dplyrAssist(iris) cat(attr(result,"code")) ## End(Not run)
Detect the valid data
findData(codes)
findData(codes)
codes |
A character vector to detect |
The last data in codes
require(tidyverse) temp <- "iris %>% group_by(Species) %>% summarize_all(mean) table1" findData(temp)
require(tidyverse) temp <- "iris %>% group_by(Species) %>% summarize_all(mean) table1" findData(temp)
Make valid R code
makeValid(temp)
makeValid(temp)
temp |
A character vector to make a valid code |
A valid R codes
require(tidyverse) temp <- "iris %>% group_by(Species) %>% summarize_all(mean) table1" makeValid(temp)
require(tidyverse) temp <- "iris %>% group_by(Species) %>% summarize_all(mean) table1" makeValid(temp)
Make valid R code
makeValidCode(codes)
makeValidCode(codes)
codes |
A character vector to make a valid code |
A valid R codes
require(tidyverse) temp <- "iris %>% group_by(Species) %>% summarize_all(mean) table1" makeValidCode(temp)
require(tidyverse) temp <- "iris %>% group_by(Species) %>% summarize_all(mean) table1" makeValidCode(temp)