You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
I installed 'ReportMort/RForcecom', ref='metadata-api' to solve an error with a query returning a long result. This worked but now other queries are returning factors instead of nums. Here is the example:
soqlQuery <- "SELECT Name, Account.Name, Owner.Name, CloseDate, CreatedDate,
Amount, Type, Renewal_Amount__c, Expansion_Amount__c, New_Amount__c
FROM Opportunity
WHERE StageName = 'Closed Won'
AND Amount > 1
"
allClosedOpps <- rforcecom.query(session, soqlQuery)
@jimclemens At the beginning of your script, run options(stringsAsFactors=F). This will force everything to come back as a character. Then use as.numeric() to cast the columns when you do further analysis on them.
The reason for not returning a numeric type is that we don't want to make any assumptions about how to cast your data while pulling it back from the API, so we return everything as strings so not to lose information you might care about.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I installed 'ReportMort/RForcecom', ref='metadata-api' to solve an error with a query returning a long result. This worked but now other queries are returning factors instead of nums. Here is the example:
soqlQuery <- "SELECT Name, Account.Name, Owner.Name, CloseDate, CreatedDate,
Amount, Type, Renewal_Amount__c, Expansion_Amount__c, New_Amount__c
FROM Opportunity
WHERE StageName = 'Closed Won'
AND Amount > 1
"
allClosedOpps <- rforcecom.query(session, soqlQuery)
Now returns:
str(allClosedOpps)
'data.frame': 748 obs. of 10 variables:
$ Name : Factor w/ 725 levels "University of Lausanne-Research Licenses",..: 1 2 3 4 5 6 7 8 9 10 ...
$ CloseDate : Factor w/ 410 levels "2014-10-20","2014-12-10",..: 1 1 2 3 4 5 6 7 8 9 ...
$ CreatedDate : Factor w/ 748 levels "2014-10-20T13:23:56.000Z",..: 1 2 3 4 5 6 7 8 9 10 ...
$ Amount : Factor w/ 177 levels "9995.0","2498.75",..: 1 2 1 3 4 5 6 2 7 1 ...
$ Type : Factor w/ 3 levels "New","Expansion",..: 1 1 2 1 2 2 2 1 1 2 ...
$ New_Amount__c : Factor w/ 95 levels "9995.0","2498.75",..: 1 2 3 4 3 3 3 2 5 3 ...
$ Account.Name : Factor w/ 409 levels "University of Lausanne",..: 1 2 3 4 5 6 7 8 9 10 ...
$ User.Name : Factor w/ 11 levels "Roger Oberg",..: 1 2 2 2 1 2 2 3 1 2 ...
$ Expansion_Amount__c: Factor w/ 83 levels "9995.0","4995.0",..: NA NA 1 NA 2 3 1 NA NA 1 ...
$ Renewal_Amount__c : Factor w/ 86 levels "5414.0","4998.0",..: NA NA NA NA 1 2 3 NA NA NA ...
Using the CRAN version it returns (notice $ Amount):
str(allClosedOpps)
'data.frame': 748 obs. of 10 variables:
$ Name : Factor w/ 725 levels "10X Genomics, Inc.-RSP",..: 675 489 21 505 619 393 6 521 326 281 ...
$ Account.Name : Factor w/ 409 levels "10X Genomics, Inc.",..: 376 268 11 277 341 210 3 290 357 147 ...
$ Owner.Name : Factor w/ 11 levels "Bill Carney",..: 8 6 6 6 8 6 6 11 8 6 ...
$ CloseDate : Factor w/ 410 levels "2012-10-09","2013-07-01",..: 77 77 100 86 76 85 148 78 92 89 ...
$ CreatedDate : Factor w/ 748 levels "2013-10-06T21:45:02.000Z",..: 122 124 129 130 120 128 131 125 132 133 ...
$ Amount : num 9995 2499 9995 10786 10409 ...
$ Type : Factor w/ 3 levels "Expansion","New",..: 2 2 1 2 1 1 1 2 2 1 ...
$ New_Amount__c : num 9995 2499 0 10786 0 ...
$ Expansion_Amount__c: num NA NA 9995 NA 4995 ...
$ Renewal_Amount__c : num NA NA NA NA 5414 ...
The text was updated successfully, but these errors were encountered: