Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Independent testing for label.R #78

Closed
LittleBeannie opened this issue Sep 14, 2022 · 5 comments · Fixed by #80
Closed

Independent testing for label.R #78

LittleBeannie opened this issue Sep 14, 2022 · 5 comments · Fixed by #80
Assignees

Comments

@LittleBeannie
Copy link
Collaborator

Test plan for get_label:

  • It returns the columns when the input data has no labels, i.e., the output of
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
get_label(tbl)

is "a", "b"

  • It returns the labels when the input data has labels, i.e., the output of
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
attr(tbl[[1]], "label") <- "variable 1"
attr(tbl[[2]], "label") <- "variable 2"
get_label(tbl)

is "variable 1", "variable 2"

@LittleBeannie
Copy link
Collaborator Author

LittleBeannie commented Sep 14, 2022

Test plan for assign_lable:

  • It gives an error message when you run
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
assin_label(tbl, var = "a", label = c("variable 1", "variable 2"))
  • It gives an error message when you run
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
assin_label(tbl, var = c("a", "a"), label = c("variable 1", "variable 2"))
  • It gives a warning message when you run
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
assin_label(tbl, var = "a", label = "variable 1")
  • After running the following code, the labels of tbl is "variable 1", "variable 2"
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
assin_label(tbl, var = c("a", "b"), label = c("variable 1", "variable 2"))
```

@ginnaram13
Copy link
Collaborator

Hi @LittleBeannie

Can you check why the label is not assigning for below;

tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3))
assign_label(tbl, var = c("a", "b"), label = c("variable 1", "variable 2"))

image

@LittleBeannie
Copy link
Collaborator Author

Hi @LittleBeannie

Can you check why the label is not assigning for below;

tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3)) assign_label(tbl, var = c("a", "b"), label = c("variable 1", "variable 2"))

image

Hi @ginnaram13 , please try tbl$a and you will find a's label is variable 1.

@ginnaram13
Copy link
Collaborator

Hi @LittleBeannie
Can you check why the label is not assigning for below;
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3)) assign_label(tbl, var = c("a", "b"), label = c("variable 1", "variable 2"))
image

Hi @ginnaram13 , please try tbl$a and you will find a's label is variable 1.

@LittleBeannie
No Luck for me
image

@ginnaram13
Copy link
Collaborator

Hi @LittleBeannie
Can you check why the label is not assigning for below;
tbl <- data.frame(a = c(1, 2, 3), b = c(-1, -2, -3)) assign_label(tbl, var = c("a", "b"), label = c("variable 1", "variable 2"))
image

Hi @ginnaram13 , please try tbl$a and you will find a's label is variable 1.

@LittleBeannie No Luck for me image

image

@ginnaram13 ginnaram13 linked a pull request Oct 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants