---
title: "Struggling with R step 5-init.R: base-unit-weight"
url: "https://openforis.support/questions/1293/struggling-with-r-step-5-initr-base-unit-weight"
tags: ["calc"]
status: "accepted"
score: 0
answer_count: 3
asked: "2017-05-22T07:16:25"
last_activity: "2017-05-24T17:34:28"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Struggling with R step 5-init.R: base-unit-weight

Asked by joseph on 2017-05-22

Dear all, I changed step 005 base-unit-weight:  <- NA to <- 1 but remain to get error, who knows solution? Thanks Joseph

Error in 'R Scripts - Processing chain' 
 2017-05-22 07:03:20     step : 1-init.R
INFO: Processing chain started 
Loading required package: methods
Loading required package: DBI
Loading required package: gsubfn
Loading required package: proto
Loading required package: RSQLite
Loading required package: RSQLite.extfuns
2017-05-22 07:03:32     step : -
ERROR: Error in postgresqlExecStatement(conn, statement, ...): RS-DBI driver: (could not Retrieve the result : ERROR:  column "weight" is of type numeric but expression is of type boolean
LINE 7: set "weight" = "r"."weight" from "r" where "mabiotis"."bioto...
                       ^
HINT:  You will need to rewrite or cast the expression.

In addition, when running the script in R no errors are recorded ecept: 
Error in calc.getQuotedFileContent(filename) : 
  could not find function "dbQuoteString"


## Accepted answer (score 0, by Mino Togna on 2017-05-24)

Link: https://openforis.support/questions/1293/struggling-with-r-step-5-initr-base-unit-weight/1299

Thanks Jos for reporting the solution !

Just let us know if other issues come up.

Thank you,

Mino


## Answer (score 1, by Mino Togna on 2017-05-22)

Link: https://openforis.support/questions/1293/struggling-with-r-step-5-initr-base-unit-weight/1295

Hi Jos,

make sure the weight is of type numeric.

Also, make sure the libraries 'RPostgreSQL' and 'sqldf' are installed.

Please let me know if that helps.

Thanks,

Mino


## Answer (score 0, by joseph on 2017-05-23)

Link: https://openforis.support/questions/1293/struggling-with-r-step-5-initr-base-unit-weight/1298

I tried your suggestions but the error messages continued to appear. Finally I reinstalled R2.3.5, before running a script I was then asked to open a CRAN mirror, i used 0 cloud, upon library packages start loading/installing... maybe this i skipped before or did not wait long enough to let the installing finish! After this the script ran without error messages. Fixed, so fellow users see that R is installed completely with required libraries. Thanks Mino
