Data output from API
arthor_uuid rank score smiles compound identifier
1 c8975496-4cb7-5fa6-a181-4044f1478eef 0 1.000 c1cc2cc(c(nc2c(c1)Cl)c3ccc[n+](c3)[O-])[C@@H](C(F)(F)F)Nc4c5c(cccn5)ncn4 AC000005306130
2 7b5b0d02-9b98-53dc-8366-08cb05f624bb 1 1.000 c1cc2cc(c(nc2c(c1)Cl)c3ccc[n+](c3)[O-])[C@H](C(F)(F)F)Nc4c5c(cccn5)ncn4 AC000005306132
vendor entries
1 GOSTAR, InChI, 3610820, LNLJHGXOFYUARS-NRFANRHFSA-N, false, false, 29-SEP-2022 10:39:33 +01:00, 29-SEP-2022 10:39:33 +01:00, Virtual, Virtual, Commercial, Commercial
2 GOSTAR, InChI, 3610727, LNLJHGXOFYUARS-OAQYLSRUSA-N, false, false, 29-SEP-2022 10:39:33 +01:00, 29-SEP-2022 10:39:33 +01:00, Virtual, Virtual, Commercial, Commercial
I want to display all data - including the "vendor entries" subset of data - in a datatable. Instead of the "vendor entries" data, "[object Object],[object Object]" is displayed.
If it is complicate to get the "vendor entries" data in a datatable, I would like at least to know how to get the "LNLJHGXOFYUARS-NRFANRHFSA-N" and "LNLJHGXOFYUARS-OAQYLSRUSA-N" values from the vendor entries column.
I have tried:
Attempt 1.
filtered_data <- as.matrix(unlist(data["vendor entries"]))
result:
[,1]
vendor entries.vendor name1 "GOSTAR"
vendor entries.vendor name2 "InChI"
vendor entries.vendors identifier1 "3610820"
vendor entries.vendors identifier2 "LNLJHGXOFYUARS-NRFANRHFSA-N"
vendor entries.discontinued1 "false"
vendor entries.discontinued2 "false"
vendor entries.timestamp1 "29-SEP-2022 10:39:33 +01:00"
vendor entries.timestamp2 "29-SEP-2022 10:39:33 +01:00"
vendor entries.source labels1 "Virtual"
vendor entries.source labels2 "Virtual"
vendor entries.compound categories1 "Commercial"
vendor entries.compound categories2 "Commercial"
vendor entries.vendor name1 "GOSTAR"
vendor entries.vendor name2 "InChI"
vendor entries.vendors identifier1 "3610727"
vendor entries.vendors identifier2 "LNLJHGXOFYUARS-OAQYLSRUSA-N"
vendor entries.discontinued1 "false"
vendor entries.discontinued2 "false"
vendor entries.timestamp1 "29-SEP-2022 10:39:33 +01:00"
vendor entries.timestamp2 "29-SEP-2022 10:39:33 +01:00"
vendor entries.source labels1 "Virtual"
vendor entries.source labels2 "Virtual"
vendor entries.compound categories1 "Commercial"
vendor entries.compound categories2 "Commercial"
then
filtered_data["vendor entries.vendors identifier2"]
however, only the first value of "vendor entries.vendors identifier2" is displayed. The second value is missing. Is there a way to get all values from the "vendor entries.vendors identifier2" rows?
Attempt 2.
api_json <- jsonlite::toJSON(structure_data, pretty = TRUE)
result
[
{
"arthor_uuid": "c8975496-4cb7-5fa6-a181-4044f1478eef",
"rank": 0,
"score": "1.000",
"smiles": "c1cc2cc(c(nc2c(c1)Cl)c3ccc[n+](c3)[O-])[C@@H](C(F)(F)F)Nc4c5c(cccn5)ncn4",
"compound identifier": "AC000005306130",
"vendor entries": [
{
"vendor name": "GOSTAR",
"vendors identifier": "3610820",
"discontinued": "false",
"timestamp": "29-SEP-2022 10:39:33 +01:00",
"source labels": ["Virtual"],
"compound categories": ["Commercial"]
},
{
"vendor name": "InChI",
"vendors identifier": "LNLJHGXOFYUARS-NRFANRHFSA-N",
"discontinued": "false",
"timestamp": "29-SEP-2022 10:39:33 +01:00",
"source labels": ["Virtual"],
"compound categories": ["Commercial"]
}
]
},
{
"arthor_uuid": "7b5b0d02-9b98-53dc-8366-08cb05f624bb",
"rank": 1,
"score": "1.000",
"smiles": "c1cc2cc(c(nc2c(c1)Cl)c3ccc[n+](c3)[O-])[C@H](C(F)(F)F)Nc4c5c(cccn5)ncn4",
"compound identifier": "AC000005306132",
"vendor entries": [
{
"vendor name": "GOSTAR",
"vendors identifier": "3610727",
"discontinued": "false",
"timestamp": "29-SEP-2022 10:39:33 +01:00",
"source labels": ["Virtual"],
"compound categories": ["Commercial"]
},
{
"vendor name": "InChI",
"vendors identifier": "LNLJHGXOFYUARS-OAQYLSRUSA-N",
"discontinued": "false",
"timestamp": "29-SEP-2022 10:39:33 +01:00",
"source labels": ["Virtual"],
"compound categories": ["Commercial"]
}
]
}
]