-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e58a541
commit cd4614b
Showing
4 changed files
with
111 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# load mtcars | ||
df <- mtcars | ||
str(df) | ||
|
||
# by default numeric columns are converted to jaspScale | ||
lapply(df, r2jasp) | ||
|
||
|
||
# change cyl to an ordinal variable | ||
df$cyl <- jaspOrdinal(df$cyl, values = c(2, 4, 6, 8), labels = c("two", "four", "six", "eight")) | ||
# change vs and am to nominal variables | ||
df$vs <- jaspNominal(df$vs, labels = c("No", "Yes")) | ||
df$am <- jaspNominal(df$am, labels = c("No", "Yes")) | ||
# create a new variable that is a nominal text | ||
df$group <- jaspNominal(rep(LETTERS[1:2], 16)) | ||
|
||
# factor and ordered will be converted to Nominal and Ordinal, respectively | ||
df$gear <- as.factor(df$gear) | ||
df$carb <- as.ordered(df$carb) | ||
|
||
str(df) | ||
|
||
# pass the data set to JASP | ||
setDataSet(df) | ||
# and retrieve it back | ||
getDataSet() |> str() | ||
# get the column specification of the set data frame as a list | ||
dataSetColumnSpecification() | ||
|
||
# check how are these columns converted back to R types | ||
getDataSet() |> lapply(jasp2r) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.