Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/namsor/namsor-R-sdk2
Browse files Browse the repository at this point in the history
  • Loading branch information
NamSor SAS committed Mar 15, 2020
2 parents e6e6f8b + fe37482 commit 8de315d
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,72 @@ Then execute
library(devtools)
install(".")
```
This is an example for processing a CSV file :
```R
library(namsor)
setwd("D:/Sync/Dropbox/NamSor_CarmenAguilarGarcia/")
names<-read.csv("combine.csv",header = F)

str(names)
names$V1<-as.character(names$V1)
names$V2<-as.character(names$V2)
names$V3<-as.character(names$V3)




gendercolcol<-vector(length = 10^6)
b<-1
c<-1000

for (i in 1:1000) {

namesnames<-names[b:c,]

r_gender<-c()

for (t in 1:1000){
for (o in namesnames$V2[t]) {
for (a in namesnames$V3[t]) {
y <- PersonalNameGeoIn$new(as.character(t+1),o,a)
}
r_gender <- c(r_gender,y)
}

}

var_gender <- BatchPersonalNameGeoIn$new(personalNames = r_gender)


api.instance <- PersonalApi$new()
api.instance$apiClient$apiKeys['X-API-KEY'] <- '<your API key>';
result_gender <- api.instance$GenderFullGeoBatch(batch.personal.name.geo.in=var_gender)

gendercol<-vector(length = 1000)

for (n in 1:1000) {
#print(result_gender$personalNames[[n]]$likelyGender)
genderdata <- result_gender$personalNames[[n]]$likelyGender
gendercol[n] <- genderdata

}


gendercolcol[b:c]<-gendercol

b<-b+1000
c<-c+1000

print(i)

}

names<-cbind(names,gendercolcol)

write.csv(names,"names.csv")

```


## Author

Expand Down

0 comments on commit 8de315d

Please sign in to comment.