[R] R write to JSON format error
robby0524
robby0524 at fpc.com.tw
Wed May 6 01:58:53 CEST 2015
Dear all
There are a stardand JSON format file from R code. It have a error on
this file.
How to modify this source code for a stardand JSON format file?
Test1:
Soure code for R studio:
Issue_Name<-c("Tag over 30% in minutes")
URL_Link<-c("http://61.221.174.234/trendalarm_all.txt")
ULink=list(Issue=Issue_Name,URL=URL_Link)
#ULink to JSON format
sink("ULink.txt")
cat(toJSON(ULink))
sink()
Result:<This is not a stardand JSON format file>
> cat(toJSON(ULink))
{"Issue":"Tag over 30% in
minutes","URL":"http://61.221.174.234/trendalarm_all.txt"}
> sink()
Test2:
Soure code for R studio:
Issue_Name<-c("Tag over 30% in minutes")
URL_Link<-c("http://61.221.174.234/trendalarm_all.txt")
ULink=list(Issue=Issue_Name,URL=URL_Link)
Run R source code, then run the below command on console windows
sink("ULink.txt")
cat(toJSON(ULink))
sink()
Result:<This is a stardand JSON format file>
{"Issue":"Tag over 30% in
minutes","URL":"http://61.221.174.234/trendalarm_all.txt"}
Thanks
--
View this message in context: http://r.789695.n4.nabble.com/R-write-to-JSON-format-error-tp4706860.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list