# ds.recodeValues.o: test development

**URL:** <https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32>\
**Category:** Developer support\
**Created:** [21 January 2019 09:54 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32 "2019-01-21T09:54:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [21 January 2019 09:54 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/1 "2019-01-21T09:54:28Z")

</div>

I am have trying to develop Unit Tests for ‘ds.recodeValues.o’. But I keep getting a “object ‘age.60’ not found”. What am I missing?

Error message:

```
test-ds.recodeValues.o.R:30: error: recodeValues_checks
Command 'recodeValuesDS1.o("age.60", "-1,-6", "-10,-16")' failed on 'survival1': object 'age.60' not found
1: ds.recodeValues.o(var.name = "age.60", values2replace.vector = c(-1, -6), new.values.vector = c(-10, 
       -16), datasources = opals) at /home/vsts/work/1/s/tests/testthat/test-ds.recodeValues.o.R:30
2: datashield.aggregate(datasources, calltext1) at /home/vsts/work/1/s/R/ds.recodeValues.o.R:145
3: datashield.aggregate.list(datasources, calltext1)
4: datashield.command_result(opal, res, wait = TRUE)
5: datashield.command_result.list(opal, res, wait = TRUE)
6: lapply(1:length(opal), function(i) {
       datashield.command_result(opal[[i]], id[[i]], wait = wait)
   })
7: FUN(X[[i]], ...)
8: datashield.command_result(opal[[i]], id[[i]], wait = wait)
9: datashield.command_result.opal(opal[[i]], id[[i]], wait = wait)
10: stop("Command '", cmd$script, "' failed on '", opal$name, "': ", msg, call. = FALSE)

```

Source: [https://github.com/StuartWheater/dsBetaTestClient/blob/master/tests/testthat/test-ds.recodeValues.o.R](https://github.com/StuartWheater/dsBetaTestClient/blob/master/tests/testthat/test-ds.recodeValues.o.R)

Stuart

---

<div class="post-metadata">

**Author:** ![demetris.avraam](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@demetris.avraam](https://datashield.discourse.group/u/demetris.avraam)\
**Post date:** [21 January 2019 12:38 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/2 "2019-01-21T12:38:39Z")

</div>

I expect that it will not fail if you use the name of the dataset and the dollar sign:

ds.recodeValues.o(var.name = “D$age.60”, values2replace.vector = c(-1, -6), new.values.vector = c(-10, -16), datasources = opals)

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [21 January 2019 14:28 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/3 "2019-01-21T14:28:25Z")

</div>

Sadly that leads to another, but different, problem.

Do I need to pre-create “D$age.60\_recoded”?

```
test-ds.recodeValues.o.R:30: error: recodeValues_checks
Command 'messageDS.o("D$age.60_recoded")' failed on 'survival1': <no message>
1: ds.recodeValues.o(var.name = "D$age.60", values2replace.vector = c(-1, -6), new.values.vector = c(-10, 
        -16), datasources = opals) at /home/vsts/work/1/s/tests/testthat/test-ds.recodeValues.o.R:30
2: datashield.aggregate(datasources, calltext) at /home/vsts/work/1/s/R/ds.recodeValues.o.R:216
3: datashield.aggregate.list(datasources, calltext)
4: datashield.command_result(opal, res, wait = TRUE)
5: datashield.command_result.list(opal, res, wait = TRUE)
6: lapply(1:length(opal), function(i) {
       datashield.command_result(opal[[i]], id[[i]], wait = wait)
   })
7: FUN(X[[i]], ...)
8: datashield.command_result(opal[[i]], id[[i]], wait = wait)
9: datashield.command_result.opal(opal[[i]], id[[i]], wait = wait)
10: stop("Command '", cmd$script, "' failed on '", opal$name, "': ", msg, call. = FALSE)
```

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [22 January 2019 23:09 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/4 "2019-01-22T23:09:02Z")

</div>

This test works if run against Paul’s Test VM “datashield\_ubuntu\_development\_101\_QA.LD.LR.OPAL.UPDATED.211218”. I suspect the cause of the problem is that the package “dsBetaTest” on GitHub needs updating.

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [27 January 2019 20:59 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/5 "2019-01-27T20:59:38Z")

</div>

I have noticed that neither the older VM or updated VM has “messageDS.o” listed as a registered method within the Opal Admin Portal, but the VM datashield\_ubuntu\_development\_101\_QA.LD.LR.OPAL.UPDATED.211218 does. Could this contribute to the problem I am seeing?

---

<div class="post-metadata">

**Author:** ![demetris.avraam](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@demetris.avraam](https://datashield.discourse.group/u/demetris.avraam)\
**Post date:** [28 January 2019 09:16 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/6 "2019-01-28T09:16:28Z")

</div>

Hi Stuart,

Yes, that’s right. I have just added the messageDS.o function in the dsBetaTest package (and the ds.message.o function in the client-side). Can you accept my commits and check if you still have an error?

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [28 January 2019 10:40 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/7 "2019-01-28T10:40:39Z")

</div>

HI, I am in process of creating a VM to test the deployment of dsBetaTest. Which has stopped working within the CI. Investigating…

Stuart

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [28 January 2019 11:43 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/8 "2019-01-28T11:43:07Z")

</div>

I now get a new message:

“Command ‘messageDS.o(“D$age.60\_recoded”)’ failed on ‘survival1’: ‘messageDS.o’ is not an exported object from ‘namespace:dsBetaTest’”

Investigating…

Stuart

---

<div class="post-metadata">

**Author:** ![olly](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/olly/32/33_2.png) [@olly](https://datashield.discourse.group/u/olly)\
**Post date:** [28 January 2019 12:10 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/9 "2019-01-28T12:10:06Z")

</div>

It’s not in the NAMESPACE file, so roxygen probably hasn’t been run.

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [28 January 2019 12:13 UTC](https://datashield.discourse.group/t/ds-recodevalues-o-test-development/32/10 "2019-01-28T12:13:16Z")

</div>

OK, I will check this within my “Fork”.

Stuart
