Skip to content

Commit

Permalink
remove check_win_devel NOTES
Browse files Browse the repository at this point in the history
  • Loading branch information
markheckmann committed Jul 20, 2024
1 parent 7e62be5 commit da9a406
Show file tree
Hide file tree
Showing 27 changed files with 203 additions and 197 deletions.
6 changes: 3 additions & 3 deletions R/calc.r
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param index Whether to print the number of the element.
#' @param trim The number of characters an element or a construct is trimmed to (default is `20`). If `NA` no trimming
#' occurs. Trimming simply saves space when displaying correlation of constructs or elements with long names.
#' @return A dataframe containing the following measures is returned invisibly (see [describe()]):
#' @return A dataframe containing the following measures is returned invisibly (see [psych::describe()]):
#'
#' - item name
#' - item number
Expand Down Expand Up @@ -1280,8 +1280,8 @@ align <- function(x, along = 0, dmethod = "euclidean",
#' @inheritParams pvclust::pvclust
#' @param seed Random seed for bootstrapping. Can be set for reproducibility (see
#' [set.seed()]). Usually not needed.
#' @param ... Arguments to pass on to [pvclust()].
#' @return A pvclust object as returned by the function [pvclust()]
#' @param ... Arguments to pass on to [pvclust::pvclust()].
#' @return A pvclust object as returned by the function [pvclust::pvclust()]
#' @export
#' @examples \dontrun{
#'
Expand Down
6 changes: 2 additions & 4 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ assign("settings", list(), envir = .OpenRepGridEnv)
.onAttach <- function(lib, pkg) {
packageStartupMessage(
"------------------------------------------------",
"\n OpenRepGrid Version ", utils::packageDescription("OpenRepGrid", fields = "Version"),
"\n OpenRepGrid v", utils::packageDescription("OpenRepGrid", fields = "Version"),
"\n Tools for the analysis of repertory grid data",
"\n For an introduction visit: www.openrepgrid.org",
"\n CAUTION: The package is in alpha phase.",
"\n Design changes may still occur.",
"\n See: https://docs.openrepgrid.org/",
"\n------------------------------------------------",
appendLF = TRUE
)
Expand Down
4 changes: 1 addition & 3 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# TODOs

* move documentation to pkgdown
* use linter / styler package for code formatting
* switch to cli package for console output?
* make some function generic so they accept repgridlists as well (index functions)
* Format scripts with RStudio comment headers to make them more readable
Expand All @@ -13,4 +11,4 @@
* intensity for elements does not yet match
* add tests for reorder
* build bipolar variant of construct matches? (similar to IC)


4 changes: 2 additions & 2 deletions man/clusterBoot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/stats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 31 additions & 26 deletions vignettes/web/basic_operations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ vignette: >
```{r include = FALSE, echo=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#")
library(OpenRepGrid)
options(width=120)
settings(show.scale=FALSE, show.meta=FALSE, show.cut=30)
options(width = 120)
settings(show.scale = FALSE, show.meta = FALSE, show.cut = 30)
```


Expand Down Expand Up @@ -56,7 +56,7 @@ Negative indexes indicate that a row and/or column is to be deleted. In order to

```{r eval=FALSE}
bell2010[-1, ]
bell2010[ , -c(1,2)]
bell2010[, -c(1, 2)]
```


Expand All @@ -71,7 +71,7 @@ bell2010[9:1, ]
Likewise we can rearrange the order of the elements. In order to facilitate a comparison between the elements self, unhappiest person you know and mother (elements 1, 3 and 6) we may want to rearrange them next to each other.

```{r}
bell2010[ , c(1,3,6,2,4,5, 7:10)]
bell2010[, c(1, 3, 6, 2, 4, 5, 7:10)]
```


Expand All @@ -80,7 +80,7 @@ bell2010[ , c(1,3,6,2,4,5, 7:10)]
Several tasks concerning reordering will be used repeatedly, like e. g. moving a construct upwards. While the extract function can fulfill this task, the code quickly becomes tedious. Hence, specialized functions are available for standard actions. E.g. to move construct 2 upwards the following two lines of code are equivalent.

```{r eval=FALSE}
bell2010[c(2,1, 3:9), ]
bell2010[c(2, 1, 3:9), ]
up(bell2010, 2)
```

Expand Down Expand Up @@ -111,22 +111,24 @@ swapPoles(bell2010, 1:3)
To change single ratings of elements on constructs also the extract function can be used. In this context, the square brackets are used to determine the part of the grid that is assigned new scores. To change the rating in cell `(1,1)` of the dataset `bell2010` to `1` type

```{r}
bell2010[1,1] <- 1
bell2010[1, 1] <- 1
```

Likewise, new scores can be assigned to a number of cells in the grid, to whole rows, to whole columns or to the entire grid. The following code gives some examples.

```{r}
x <- bell2010[1:4, 1:5] # subset of the Bell2010 data set with four rows and five columns
x[1:3, 1] <- c(1,4,3) # rows 1 to 3 in column 1
x[1, c(1,4)] <- c(2,2) # columns 1 and 4 in row 1
x[1, ] <- c(2,2,1,4,3) # all columns in row one
x[ ,1] <- c(2,2,1,4) # all rows in column one
x[ , ] <- c(1,2,3,4, # whole grid column wise
1,2,3,4,
1,2,3,4,
1,2,3,4,
1,2,3,4)
x <- bell2010[1:4, 1:5] # subset of the Bell2010 data set with four rows and five columns
x[1:3, 1] <- c(1, 4, 3) # rows 1 to 3 in column 1
x[1, c(1, 4)] <- c(2, 2) # columns 1 and 4 in row 1
x[1, ] <- c(2, 2, 1, 4, 3) # all columns in row one
x[, 1] <- c(2, 2, 1, 4) # all rows in column one
x[, ] <- c(
1, 2, 3, 4, # whole grid column wise
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4
)
```


Expand All @@ -141,7 +143,7 @@ setConstructAttr(boeker, 1, "new left pole", "new right pole")
To change element the label of the first element, proceed likewise.

```{r}
setElementAttr(boeker, 1, "new name")
setElementAttr(boeker, 1, "new name")
```


Expand All @@ -150,13 +152,13 @@ setElementAttr(boeker, 1, "new name")
Sometimes it is necessary to add an element or a construct. This can be achieved by modifying the input file itself. Another option is to use the functions addConstruct and addElement. The following call will add a construct and the corresponding ratings to the bell2010 dataset. The left and right pole are labeled “left pole” and “right pole” respectively.

```{r}
addConstruct(bell2010, "left pole", "pole right", c(3,1,3,2,5,4,6,3,7,1))
addConstruct(bell2010, "left pole", "pole right", c(3, 1, 3, 2, 5, 4, 6, 3, 7, 1))
```

The following code will add an element with the label “new element” to the dataset.

```{r}
addElement(bell2010, "new element", c(1,2,5,4,3,6,5,2,7))
addElement(bell2010, "new element", c(1, 2, 5, 4, 3, 6, 5, 2, 7))
```


Expand All @@ -166,13 +168,16 @@ The import functions make use of internal functions to construct a grid from scr

```{r}
args <- list(
name= c("element 1", "element 2", "element 3", "element 4", "element 5"),
l.name= c("left pole 1", "left pole 2", "left pole 3", "left pole 4"),
r.name= c("right pole 1", "right pole 2", "right pole3 ", "right pole 4"),
scores= c(4,4,6,5,1,
2,7,6,5,2,
6,3,1,6,4,
6,7,5,6,3))
name = c("element 1", "element 2", "element 3", "element 4", "element 5"),
l.name = c("left pole 1", "left pole 2", "left pole 3", "left pole 4"),
r.name = c("right pole 1", "right pole 2", "right pole3 ", "right pole 4"),
scores = c(
4, 4, 6, 5, 1,
2, 7, 6, 5, 2,
6, 3, 1, 6, 4,
6, 7, 5, 6, 3
)
)
newGrid <- makeRepgrid(args)
newGrid <- setScale(newGrid, 1, 7)
newGrid
Expand Down
30 changes: 16 additions & 14 deletions vignettes/web/clustering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ vignette: >
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#")
library(OpenRepGrid)
settings(show.scale=FALSE, show.meta=FALSE)
settings(show.scale = FALSE, show.meta = FALSE)
```

### Description
Expand Down Expand Up @@ -58,51 +58,53 @@ cluster(bell2010)
The function also returns the reordered matrix invisibly. To see the reordered grid save it into a new object. To oppress the creation of a graphic set `print = FALSE`.

```{r message=FALSE, warning=FALSE}
x <- cluster(bell2010, print=FALSE)
x <- cluster(bell2010, print = FALSE)
x
```

The function also allows to only cluster constructs or elements. To only cluster the constructs us the following code. Again a dendrogram is drawn and a grid with reordered constructs is returned.

```{r message=FALSE, warning=FALSE}
x <- cluster(bell2010, along=1, print=FALSE)
x <- cluster(bell2010, along = 1, print = FALSE)
x
```

To only cluster the elements set `along=2`.

```{r message=FALSE, warning=FALSE}
x <- cluster(bell2010, along=2, print=FALSE)
x <- cluster(bell2010, along = 2, print = FALSE)
x
```

To apply different distance measures and cluster methods us the arguments `dmethod` and `cmethod` (here `manhattan` distance and `single` linkage clustering).

```{r message=FALSE, warning=FALSE}
x <- cluster(bell2010, dmethod="manh", cmethod="single", print=FALSE)
x <- cluster(bell2010, dmethod = "manh", cmethod = "single", print = FALSE)
x
```

To apply different methods to the constructs and the rows, use a two-step approach.

```{r message=FALSE, warning=FALSE}
# cluster constructs using default methods
x <- cluster(bell2010, along=1, print=FALSE)
x <- cluster(bell2010, along = 1, print = FALSE)
# cluster elements using manhattan distance and single linkage clustering
x <- cluster(x, along=2, dm="manh", cm="single", print=FALSE)
x <- cluster(x, along = 2, dm = "manh", cm = "single", print = FALSE)
x
```

Some other options can be set. Paste the code into the R console to try it out. See `?cluster` for more information.

```{r eval=FALSE}
cluster(bell2010, main="My cluster analysis") # new title
cluster(bell2010, type="t") # different drawing style
cluster(bell2010, dmethod="manhattan") # using manhattan metric
cluster(bell2010, cmethod="single") # do single linkage clustering
cluster(bell2010, cex=1, lab.cex=1) # change appearance
cluster(bell2010, lab.cex=.7, # advanced appearance changes
edgePar = list(lty=1:2, col=2:1))
cluster(bell2010, main = "My cluster analysis") # new title
cluster(bell2010, type = "t") # different drawing style
cluster(bell2010, dmethod = "manhattan") # using manhattan metric
cluster(bell2010, cmethod = "single") # do single linkage clustering
cluster(bell2010, cex = 1, lab.cex = 1) # change appearance
cluster(bell2010,
lab.cex = .7, # advanced appearance changes
edgePar = list(lty = 1:2, col = 2:1)
)
```

#### Bootsrapped clustering
Expand Down
14 changes: 7 additions & 7 deletions vignettes/web/constructs-correlation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ vignette: >
```{r echo=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#")
library(OpenRepGrid)
options(width=120)
settings(show.scale=FALSE, show.meta=FALSE)
options(width = 120)
settings(show.scale = FALSE, show.meta = FALSE)
```


Expand Down Expand Up @@ -42,20 +42,20 @@ As suggested by Hinkle (1965) the relationships between constructs may take seve
#### Correlation measures

```{r}
constructCor(mackay1992)
constructCor(mackay1992)
```

you can select between the different types of correlation by setting the argument `method` to `"pearson"`, `"kendall"` or `"spearman"`. To request a Spearman rank correlation type

```{r}
constructCor(mackay1992, method="spearman")
constructCor(mackay1992, method = "spearman")
```
To format the output several arguments are available. See `?print.constructCor` for more printing options.

```{r}
r <- constructCor(mackay1992)
print(r, digits=5, col.index=F)
print(r, digits = 5, col.index = F)
```


Expand All @@ -64,7 +64,7 @@ print(r, digits=5, col.index=F)
To calulate the RMS correlation

```{r}
constructRmsCor(fbb2003)
constructRmsCor(fbb2003)
```

#### Somers' D
Expand All @@ -78,7 +78,7 @@ constructD(fbb2003)
To set the rows as dependent, type

```{r eval=FALSE}
constructD(fbb2003, dep="r")
constructD(fbb2003, dep = "r")
```


Expand Down
12 changes: 6 additions & 6 deletions vignettes/web/constructs-distances.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ vignette: >
```{r echo=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#")
library(OpenRepGrid)
options(width=120)
settings(show.scale=FALSE, show.meta=FALSE)
options(width = 120)
settings(show.scale = FALSE, show.meta = FALSE)
```


Expand Down Expand Up @@ -43,20 +43,20 @@ distance(fbb2003)
Distance for elements:

```{r}
distance(fbb2003, along=2)
distance(fbb2003, along = 2)
```

To change the distance measure supply any unambigous string of the available distance methods to the argument dmethod. E.g. for the manhattan distance bewteen constructs:

```{r}
distance(fbb2003, dmethod="manhattan")
distance(fbb2003, dmethod = "manhattan")
```

For other distance metrics:

```{r results='hide'}
distance(fbb2003, dm="canb") # canberra distance for constructs
distance(fbb2003, dm="mink", p=3) # minkowski metric to the power of 3 for constructs
distance(fbb2003, dm = "canb") # canberra distance for constructs
distance(fbb2003, dm = "mink", p = 3) # minkowski metric to the power of 3 for constructs
```

If the distances are calculated for further processing, the printing to the console can be surpressed distance and the results can be saved into an object (here d).
Expand Down
Loading

0 comments on commit da9a406

Please sign in to comment.