R Blogdown: insert images side by side using knitr - r

I am working on a personal website using blogdown. I know about the handy addin for inserting an image - it works well, but for only one image. Is there a way, using knitr::include_graphics, to insert multiple images side-by-side?
I'm aware of using something like this:
![image text](path/to/image.png) ![other image text](path/to/image2.png)
But this cannot adjust the size of each image, which is an important formatting option for me.
Note:
While poking around for a solution before I post this question, I found this github issue which seems to be similar to what I'm talking about.
Edit:
Using something like this:
<img src="path/to/image.png" width="50%"/><img src="path/to/image2.png" width="50%"/>
Was suggested, but it only displays the images on top of each other in the document.

I'll post the solution mentioned in the above comments since it worked the best for me, and I'll certainly come back to this post to use this in the future. The answer here seems to be the only thing that works for me. If getting the path name correct is difficult, run the command getwd() in the line above to make sure readPNG is looking in the right place.

Related

What is the proper way to insert academicons in an R blogdown post (`icon::ai("GitHub")` interferes with share header icons)?

I am using R blogdown with the hugo-academic theme and love Yihui's work (and naturally the theme).
I inserted acidemicons in a post using the icon package (https://github.com/ropenscilabs/icon), e.g.,
- [Mendeley `r icon::ai("mendeley")`](https://www.mendeley.com)
Unfortunately, this somehow clashes with the icons in the share header (only the envelope/email icon shows up and the remaining do not, i.e., twitter, facebook and linkedin). In other posts with no icon::ai() calls the header is fine.
Here is the post with the call (note the share icons at the top right are greyed out)
https://racinejs.netlify.com/post/academic-networks-public-profiles/
Here is a post without (note the share icons at the top right are well formed)
https://racinejs.netlify.com/post/github-education-and-private-repositories/
So, I am guessing there is an alternate way to include the academicons in the R blogdown/R markdown post that does not rely on the icon package, but my unfamiliarity with this framework is working against me. I have been unable to dig up any other way of successfully doing this hence my post.
The GitHub repository for the site can be found at https://github.com/JeffreyRacine/static-hugo-site in case this is helpful.
So, if by chance you know the proper way to do this I would be most grateful.
Thanks in advance for your efforts and suggestions!
In case this helps others, after all that some experimenting and looking at the theme code revealed that
<i class="ai ai-mendeley"></i>
is all that is needed and resolves the issue.

Instant article and repeating image

I received this general warming:
General Warnings: Repeating Cover Image and First Image: The cover image and the image '9iememaison.quebec_v1xi5heeg9_8dqdz.png' seem to be the same or almost the same image. Please consider removing or replacing one of the images.
So I dug into the internet and I found nothing - except this:
https://wordpress.org/support/topic/same-image-displayed-twice
"I performed the preg replace on function "get_the_content()" of "class-instant-articles-post.php" just before returning the variable $this->_content;"
But my problem is that my cover image and first image are the same. How do I either remove the cover image, or rename the first image in a way like WordPress and instant article thing? It's an other image but at the moment it's the same image, because my feature image on my website and the thumbnail generate and image use in post are all the same. I don't use different image, so the best way is maybe like making a WordPress function that:
Copies the image
Renames the image
Puts that link in the post and if image is update then this image also.
Or maybe I'm just going to deep and there is an easier way to fix this.I didn't find it after checking all the instant article wp support, and looking through the web.
The best way to solve this, if you often have this situation, is probably to disable the Cover Image entirely by hooking into the plugin.
This can apply even if the error/warning doesn't show. I have found it doesn't show a warning when the images are pretty much exactly the same, which is strange, only when they are very different in size but same content/name.
Haven't found a solution for disabling Cover Image. Will hopefully update this if I end up having to create one.
Here's another relevant thread:
https://wordpress.org/support/topic/general-warningrepeating-cover-image-and-first-image/#post-8731646
and a very relevant github ticket:
https://github.com/Automattic/facebook-instant-articles-wp/issues/57

R code ggplot/googlemaps

I am trying to get this to work (the links below are all the same thing really) code included at bottom of first link.
Looks like the google maps part doesn't work, does anyone know why?
Also looks like the text overlay doesn't work, also why?
http://workfeed.baileyplex.com/2013/02/maps-in-r-choropleth-maps.html
http://www.r-bloggers.com/maps-in-r-choropleth-maps/
http://www.milanor.net/blog/?p=634
Originally, I couldn't get anything to work but found a post on here about reinstalling several packages and that got me to this point.

Messed up my site's CSS

Well, I did something pretty stupid. I'm using ruby on rails, and I was adding glyphicons to my site , but for some reason they weren't loading properly. A plus sign in my header looked small, and the edit and delete signs on another page came up as rectangles (The browser I was using was Chrome, and all of this was looked at via LocalHost:3000).
I decided to copy and paste the bootstrap_and_customization.css.scss file from a git-hub page into my own respective file, just to experiment.
I didn't see much of a difference, aside from spacing. After saving, I found that my website looked completely different. All the CSS and Bootstrap elements seem to be gone. I clicked undo, saved again, and found that my website still looks bizarre.
I'm using gems, which has been pretty easy so far, but right now I'm stumped. I even did git reset --hard, so I know all of my code is as it was before I screwed things up.
Could you please help me?
Do you have something that is compiling the *.SCSS files into *.CSS? If not then they won't do anything.

In-text hyperlinks shown by Internet Explorer without the following space. What can be the reason? YUI?

I've a problem which is most likely some ugly CSS mistake, but I just can't spot the solution (and a few changes I tried did not help).
Some of in-text hyperlinks (not all!) are shown by Internet Explorer without the following space.
here is the example
See the link WatchBot just below the Rationale title (and a few similar links deeper in the article). Firefox, Opera, Chrome, Konqueror - all display it properly: WatchBot can. IE (6.0 but IIRC also 7.0) displays it as **WatchBot***can*.
I am using Yui-reset and yui-base. Is it possible that those libraries cause the problem?
Do you have a script running on, and altering, the content in any way? I say this because the page loads normally initially, but looks as though it undergos some modification later in the loading lifecycle.
If you think reset or base are making this happen try removing them one at a time - I haven't had any experience of this error before however (I usually use the full whack: Reset, Grids, Base and Fonts).
What I did notice however is that the first WatchBot link of the page is simply this:
<p>Have you ever been curious how is
WatchBot
picking the games to observe and save? Here is the explanation.</p>
Where as the second link looks like this:
<span>Due to the FICS limitations </span>
WatchBot<span> can
I have no idea what that second span is doing there - might be something to check up on. (It validated fine however - so there's definitely an closing span somewhere).
I'd say a good place to start would be to but a space after the anchor but before the span, rather than right after the span start tag.
Current state of the things: as steve_c spotted first, and buti-oxa confirmed, it looks like the layout is being spoiled by javascript (and as Ross noted, some extra spans are injected). Thank you all, I missed it.
I am to make experiments and selectively disable those scripts (analytics and google ads) to check whether it helps (my current bet is that maybe I have some HTML error or naming conflict)
Did you try to disable pageTracker? It seems to be the only script on your page, and it looks fine to me in its static form.
EDIT: I wondered what span Ross was talking about - I did not see any. I viewed the source. I just learned that Firefox allows to see both source and generated source (Toos/Web Developer/View Source). Sure enough, generated source has additional span inserted.
Solution: my page was spoiled by the text-link-ads script (which, in fact I activated on English blog by mistake - this is script by adkontekst.wp.pl, Polish firm). After disabling it everything is OK.
Thanks for everybody who pointed me into the right direction.

Resources