Wrong data coming through on Windows, but not Mac R-Studio Shiny - shiny

When I pull in data from a csv:
descriptions <- read.csv("descriptions.csv")
on a Windows machine, and use outputText
output$textDesc <- renderText({ descriptions[1,1] })
The output shows a "1".
When I use the same code on a Mac, I get the data that is in descriptions[1,1] which is a string of information that I want displayed.
How can I get the text in descriptions[1,1] to show up on the Windows machine?

Related

How can I write R ggplot charts into palantir foundry file system?

looking for a way to use foundry code repository to write a visualisation created via an R-Script using ggplot2 into the foundry file system.
Great question! This is answered in the documentation here: https://www.palantir.com/docs/foundry/code-workbook/transforms-unstructured/#example-saving-a-plot-to-a-pdf
It is possible to write to an output FileSystem. This can be useful to write non-tabular data formats including images, PDFs, text files, and so on.
Call new.output() to instantiate a TransformOutput. Learn more about the FileSystem API.
You can only write files using TransformOutput in nodes that are saved as datasets. You cannot write files using TransformOutput in the console.
Here is an example with a scatterplot (saved to a PDF to maintain good resolution):
plot_pdf <- function() {
library(ggplot2)
theme_set(theme_bw()) # pre-set the bw theme
data("midwest", package = "ggplot2")
# Scatterplot
gg <- ggplot(midwest, aes(x=area, y=poptotal)) +
geom_point(aes(col=state, size=popdensity)) +
geom_smooth(method="loess", se=F) +
xlim(c(0, 0.1)) +
ylim(c(0, 500000)) +
labs(subtitle="Area Vs Population",
y="Population",
x="Area",
title="Scatterplot",
caption = "Source: midwest")
output <- new.output()
output_fs <- output$fileSystem()
pdf(output_fs$get_path("my pdf example.pdf", 'w'))
plot(gg)
}

Deactivate inline chunk output cache in RStudio

I have a .Rmd file with the following content
```{r, cache=FALSE}
x <- rnorm(10)
plot(x)
```
and running it in RStudio gives the output
If I save the file, close RStudio and open the file again, the output is still there despite the cache=FALSE setting. How can I deactivate that the plot, or chunk output in general, is cached and not displayed If the .Rmd file is opened the next time? Where is this cache stored on my system?

Changing decimal and group mark in rmarkdown render

I am working in RStudio (on a Mac) to write reports which are rendered as PDF.
I am working in an English locale.
The report, however, is in German and I would like to use German decimal and group (thousands) marks in the report without changing the locale of the OS (or R).
I would like to do this by setting one global option at the beginning of the Rmd file.
Is there a way to accomplish this?
Up until now I tried
command line in Terminal
defaults write org.R-project.R force.LANG de_AT.UTF-8
This only changed the UI language used by R itself, no by RStudio.
Sys.setlocale("LC_NUMERIC","de_DE")
in an Rmd document produces
Error: package or namespace load failed for ’sf': .onLoad failed in loadNamespace() for ’units’, details: call:
udunits_initCfile.path(.get_ud_xml_dir(), "udunits2.xml")) error: Error in function udunits.init: Can't open
installed, default, unit database Execution halted
Putting
NUMERIC="de_DE"
LC_NUMERIC="de_DE"
in .Renviron does not help either
Quoting ?locales
Setting "LC_NUMERIC" to any value other than "C" may cause R to function anomalously, so gives a warning. Input conversions in R itself are unaffected, but the reading and writing of ASCII save files will be, as may packages which do their own input/output.
Setting it temporarily on a Unix-alike to produce graphical or text output may work well enough, but options(OutDec) is often preferable.
So let's try that:
---
output: pdf_document
lang: de-DE
---
```{r echo=FALSE}
options(OutDec = ",")
library(sf)
knitr::kable(head(mtcars))
```
Dies ist ein nichtssagender Blindtext inklusive R output `r pi` der genau so
lang ist, dass es zu Zeilenumbrüchen mit Trennung kommt.
Result:
Notes:
There is no group-separator, since R does not use that in its output.
I have added lang: de-DE to enable German hyphenation patterns.
Loading the sf package works without problems.

With QPrinter::HighResolution not printing

I implement the ability to print reports in my project. Reports are presented as HTML content. I use for print QWebEnginePage. I need high resolution print output for reports:
QPrinter printer = new QPrinter(QPrinter::HighResolution);
But when printing with the "print" function, print fails, with message in debug:
QImage: out of memory, returning null image
When printing with ScreenResolution, everything is fine, but the result is poor quality.
Version Qt - 5.10.1
Probably you are indeed running out of memory.
Try to convert your web page into something that renders better, e.g. PDF and print the PDF instead.

SAS 9.3 rsubmit email

I’ve recently been upgraded from SAS 9.2 (32-bit) to SAS 9.3 (64-bit) with Office 2010 (32-bit).
Almost everything seems to work fine, however I can’t get SAS to send emails without a remote submit!
If I submit locally, I get the message “ERROR: Undetermined I/O failure“ and a pop up from Excel stating “Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client.”
My outlook is the default mail client!
Does anyone know why this is?
If I do remote submit, I then I can’t attach files stored on my desktop or shared drives!
Sample of my code is below:
rsubmit;
filename outmail email
subject="Cars (secure)"
TO= ("email")
CC= ("email")
ATTACH= "C:\\Book1.xlsx";
DATA _NULL_;
FILE outmail;
PUT "Hello All,";
PUT " ";
PUT "Please find attached the Cars file.";
PUT " ";
RUN;
Any help is very much appreciated.
The issue is with the local configuration. There are three different approaches you can take:
1 - Click Start / Control Panel / Programs / Programs and Features / Microsoft Office 2010 / Change / Repair / Continue. Now follow the repair process.
2 - Click Start / Type & select "Default Programs" - follow the on-screen instructions to set Outlook as the default.
3 - Browse to the location below, and delete MSMAPI32.DLL:
C:\Program Files\Common Files\System\MSMAPI\1033
The file will be recreated once Outlook 2010 relaunches.