Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
R script calling in PHP for online statistical analysis of the HTML input data

After the varibles as $alldata; I wrote this for call an R script called rCommands

echo "<p><pre>".print_r($allData, true)."</pre></p>";
echo "<p>Saving the received json into file dataReceived/input_".$timeStamp.".json</p>"; 
file_put_contents("dataReceived/input_".$timeStamp.".json", json_encode($allData)); 
echo "<p>Calling R code to compute min, mean, and max values</p>";
exec("Rscript rCommands.txt ".$timeStamp);
echo "<p>Parsing the result dataReceived/output_".$timeStamp.".json of the R code</p>";
$result = json_decode(file_get_contents("dataReceived/output_".$timeStamp.".json"), true);
echo "<p>Result: ".print_r($result, true)."</p>";```

Here the R code in which I want to obtain a data.frame, and then use for the statistical analysis

library("RJSONIO")
args = commandArgs(trailingOnly=TRUE)
if (length(args) != 1) {
  stop("Exactly one argument must be supplied (timestamp).n", call.=FALSE)
}
allData<- fromJSON(paste("dataReceived/input_", args[1], ".json", sep = ""))
data= as.data.frame(allData)
x <- toJSON(data)
fileConn<-file(paste("dataReceived/output_", args[1], ".json", sep = ""))
writeLines(x, fileConn)
close(fileConn) 
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda