Image not showing in Shiny app R - r

I have an image i'd like to embed into my shiny app, and have read as much as I can find on how to do it. Although, all I get is a blue question mark when I run my code.
This is the line of code I have added, within the fluidPage ui command
img(src="logo.png", align = "right",height='100px',width='400px')
My image has been placed in the project directory folder, as well as trying in a separate folder inside named www (as per suggestion given here)
EDIT: Code used in the following context:
ui <- fluidPage(titlePanel("Test title"),
img(src="logo.png", align = "right",height='100px',width='400px'),
hr())

After coming back to this problem, I found that the solution is to simply format the Shiny code properly, by naming the R file app.R, and clicking Run App as opposed to selecting all of the code and running within the console.
Not sure how or why this makes a difference, but the numerous Shiny applications I have worked on since have all been resolved when doing this.

Just a note that may be helpful to someone else, it just happened to me: please double check if your app.R is in the root directory. I.e, app.R is on the same level as the www folder. I know it seems trivial, but if you (as I just did) put app.R into a subfolder and click Run App, the app can still run, just without the pictures.

I was having the same problem. To solve this, just create a folder named 'www' in the same folder as your app.R script and put the images within that folder.
I found the solution to this problem in the tutorial video in this page: Shiny Tutorial Video - Adding Static Content
Watch from 1h45min00sec.

You should check if the name of your R code file is called “app.R" instead of called xxx.R. this error also happened to me

Related

ASP.net; automatically generated .js classes cannot be altered in their base files

I am working on something that totally baffles me. In my ASP.net project, I have this file:
It goes by the name of base.js and is a mere 4214 lines long.
If I hit debug in my app, then suddenly, a new folder appears in within my solution that goes by the name of "script documents", and looks like this:
At the very bottom , you see a little file called: base.js.
This file is an exact copy of my base.js from "earlier".
Now, I can even make stop points inside this automatically generated file and they work!
But if I now were to make changes to the base.js file (the OG one), none of the changes are transmitted to the auto generated file.
I guess this has something to do with the version code, but I couldnt really figure out how that works.
How can I alter these auto generated script files?
Thank you!

Shiny server - CSS

I have a question regarding how to apply colours and layout to all the apps in shiny.
I have all my apps saved here:
/srv/shiny-server/all_apps/
And I have three apps:
/srv/shiny-server/all_apps/app_1/
/srv/shiny-server/all_apps/app_2/
/srv/shiny-server/all_apps/app_3/
I know that if I need to include a CSS file for the app_1, I need to create inside app_1 a www folder and save the CSS file inside.
But I don't know where I need to save the CSS/HTML files to create a nice interface where the user can select the app that they want. Right now if I go to the following page:
/srv/shiny-server/all_apps/
I have an ugly first page to select one of the three apps (see below).
Index of /all_apps/
app_1/
app_2/
app_3/
Could anyone help?
Thanks,
Julen
Then you just need to save HTML/CSS files for a start page in /srv/shiny-server/all_apps :)
It's important to name the HTML file "index.html", otherwise it won't work.

How do I host an interactive (shiny) knitr/rmarkdown doc on GitHub Pages?

I have an .rmd file containing working code for a Shiny interactive knitr/rmarkdown doc. I want this doc to run via GitHub pages.
How do I do this? (Can someone walk me through the steps clearly and fully).
I understand I have to create a gh-pages branch and upload the files there. However, I don't understand what to do with my .rmd file. Do I simply just resave it as an .html file? Or does an html file have to contain something in addition to the rmd file?
Please help explain this to me -- I've spent all day trying to figure this out, but I can;t get anything to work right :(.
Prior effort: I tried following the lead given by this SO.post, but the best I can get is a screen full of block text. No formatting, code or images show up. Just the whole document's text.

Multiple plots side by side in a Shiny app

I have previously created apps where the plots were placed side by side by using the width attribute. However, for this new app it doesn't work, and I can't seem to find the reason why.
Previous app where it works, live version. GitHub repo. Or run using (load Shiny library first):
runGitHub("deleetdk/regression_towards_the_mean")
The new app where it doesn't work. GitHub repo. Or run using:
runGitHub("deleetdk/classification_multiple_predictors")
The relevant code looks identical to me. What am I overlooking?
The app where it works uses custom CSS to set float:left: https://github.com/Deleetdk/regression_towards_the_mean/blob/master/www/style.css
https://github.com/Deleetdk/regression_towards_the_mean/blob/master/ui.R#L13

How do I add a link to open a pdf file in a new window from my R shiny app?

I can use a() to add a hyperlink in to an external site from my Shiny app,
a("google",href="http://www.google.com")
but how do I make a link to open a pdf (or similar) file? Seems like it should be simple, but I can't find any examples. My question is similar to this one:
Add link to R Shiny Application so link opens in a new browser tab
but I don't know how to structure the href part- where do I put the file to be opened and how do I specify its location? I've tried simple things like http:///C:/Folder/file.pdf or file:///C:/Folder/file.pdf but the file is either not found or wont open.
I am new to shiny and have no html experience, so any suggestions greatly appreciated.
Thanks
Put the pdf file inside the "www" directory (it has to be a subdirectory inside the directory where there are ui.r and server.r )
then you can run your shiny with:
a("click on me",target="_blank",href="myfile.pdf")

Resources