shinyapps.io read.csv of an uploaded file issue

169 views
Skip to first unread message

anthon...@gmail.com

unread,
Jul 28, 2015, 10:52:33 AM7/28/15
to Shiny - Web Framework for R
Hi All,

So, thanks to Andy's help in a previous posting I was able to get my shiny server hosted app to connected to a remote mysql database.

Now, however, I am encountering issues when trying to store an uploaded .csv file as a dataframe using read.csv. The problem is that using the following code:

 some_dataframe<-read.csv(input$file1$datapath,header=F,skip=3)


I obtain a data.frame that contains an odd sequence of rows from the file I attempt to upload. To elaborate, when I preview the dataframe with "head(some_dataframe)" it returns rows numbered 1, 6, 2, 3 for one column and 2, 1, and 4 for the next column and so on in what appears to be an almost random fashion. I suspect an encoding issue but can't come up with a solution after reading around and trying to toggle different arguments of read.csv(). 


After the file is uploaded to my app I calculate the max using:

as.numeric(t(apply(some_dataframe,2,max,na.rm=T))) 

which returns a vector with a lot of identical values which shouldn't be the case since each column has a unique max. This is where I noticed something was off, but it appear to be an issue with reading in the file in the first place. 


My app is hosted on the shinyapps.io servers and I am deploying from a Mac OSX computer.


Any help is greatly appreciated.

anthon...@gmail.com

unread,
Jul 28, 2015, 2:43:57 PM7/28/15
to Shiny - Web Framework for R, anthon...@gmail.com
Update:

Sorry guys, it appears to be an issue with the apply function. I just need to get the max of all columns. I was able to reproduce the error locally, whereas before it ran fine locally, so this isn't a shiny issue after all. 

Parindsheel Dhillon

unread,
Dec 6, 2015, 3:45:44 AM12/6/15
to Shiny - Web Framework for R
Hi Anthony,

Hope you doing great with shiny R mysql by now.
I am in the the same boat, in which you were around six months back.
i am unable to use my shiny app on shinyapps.io, whereas locally it is working fine. i am also fetching data from mysql server.

I have searched online for this problem a lot, but could get ahead.
Can you please give me example from your R code used in publishing shiny app on shinyapps.io while fetching data from sql db.

secondly, i was wondering, if i publish this app, will my server user id password be safe or not. i have read some sql injections etc
I am sure you must have gone through these queries by now.

Please help me,as publishing this app is really important for me & i dont find anyone who can help me out except you
Thanks in advance
Reply all
Reply to author
Forward
0 new messages