Questions tagged [r-glue]
76 questions
0
votes
2 answers
Glue string adds double quotations or backslashes which throws error in database query
How do I return a string with only single quotes from the glue::glue_sql command? I have tried two different approaches:
Approach 1
con <- RAthena::dbConnect(RAthena::athena(),
s3_staging_dir = s3_staging_dir)
column_values <-…

Douglas
- 223
- 1
- 9
0
votes
0 answers
Evaluate glue inside data.frame
I'm trying to evaluate a glue template row by row inside a data.frame.
library(tidyr)
library(dplyr)
library(glue)
expand_grid(var1 = c("A", "B"),
var2 = c("x", "y", "z")) %>%
full_join(data.frame(text_model = c("First {var1} and then…

qfazille
- 1,643
- 13
- 27
0
votes
0 answers
glue syntax error while generating Table summary with gtsummary
Appreciate any help to fix this error. Thank you!
Code I am using:
adata_sl %>%
select(BLADA_FL,PREVADA_FL,TRTP) %>% #mutate(BLADA_FL=ifelse(BLADA_FL=="Negative",NA_character_,BLADA_FL)) %>%
tbl_summary(value=list(PREVADA_FL~"Positive"),
…

nmfsci
- 5
- 2
0
votes
1 answer
How to use glue inside of lapply
I'm trying to use the function glue_sql inside of lapply, but I'm running into a problem.
I have a long list of IDs to use in a WHERE clause. That list is too long for SQL Server and results in an error, so I am trying to cut the list into pieces to…

hmhensen
- 2,974
- 3
- 22
- 43
0
votes
2 answers
Error while trying to append Year in the XLSX sheet using glue function in R Programming
Using R trying to print a sheet in xls output format.
Trying to get the year name in dynamically using a parameter in R.
Using this parameter trying to rename the Excel sheet year.
But glue string is printing instead of parameter.
if…

BobbyG
- 45
- 5
0
votes
2 answers
R: SQL query for mean extraction
I'd like to aggregate CD mean by CD_TALHAO, ID_UNIQUE and DATA_S2 using a SQL query with glue package. But when I try:
library(dplyr)
library(rgdal)
library(rgeos)
library(DBI)
library(glue)
# get AOI
download.file(
…

Leprechault
- 1,531
- 12
- 28
0
votes
2 answers
In R how to use mutate with glue to create columns
This is my code
col_vec <- vector(length = 11)
my_df <- mtcars
for (i in 1:11) {
col_vec[i]<- glue::glue("col{i}")
colnames(my_df) <- col_vec
}
I want to do this bellow for all columns but I would like to use glue package:
my_df %>%…

Laura
- 675
- 10
- 32
0
votes
1 answer
How to change table header that is not static
I'm trying to create a table in which the headers can change from time to time which means that the headers are not static.
Kindly see the sample below.
Create variable months with the code…

Yomi.blaze93
- 401
- 3
- 10
0
votes
1 answer
How to resolve Error in parse(text = text, keep.source = FALSE) : when creating a Dataframe
I'm trying to create a data frame with a glue package
previous_month<-sum(June_count$Tranx_count)
recent_month<-sum(July_count$tranx_count)
formula =(recent_month-previous_month)/previous_month
formula<-scales::percent(formula)
#creating…

Yomi.blaze93
- 401
- 3
- 10
0
votes
1 answer
How to impurt value and name from table to curly bracket using glue or any package in r
I have a table that I want to use the information there to mix with the below write up
using glue package or if there are other packages in r that can handle the situation better I'm open to suggestion
First table
Client
Average
Pay…

Yomi.blaze93
- 401
- 3
- 10
0
votes
1 answer
Using glue_data() in a function works with some column names and not others
I'm working on a function that takes a dataframe and user-specified columns as inputs and uses glue_data() to output some nicely formatted text.
Whether or not a variable works seems to be the luck of the draw, but is consistent from attempt to…

mweylandt
- 108
- 5
0
votes
3 answers
refer to quoted column name in a function in R
I want to use the na_omit function from the collapse package in a user-defined function. na_omit requires a column name to be in quotes as one of its arguments. If I didn't need the column name in quotes, I could just refer to the column name in…

Ted M.
- 182
- 1
- 8
0
votes
1 answer
How to automate date sting with glue
I'm trying to automate DateTime to always generate a report on t+1
so I did
the date format in the df is like this 2021-12-21 23:59:52
2021-12-21 21:37:50
2021-12-21 19:41:18
2021-12-21 19:21:36
2021-12-21 19:15:41
2021-12-21 19:15:36
yesterday<-…

Yomi.blaze93
- 401
- 3
- 10
0
votes
1 answer
Paste glue objects together run in loops
I am trying to paste two glue strings together in a for loop but I am not getting desired results.
e.g. in the reproducing example I have two columns and I want to loop over first column first (once) and apply function(x) on each value of second…

ok1more
- 779
- 6
- 15
0
votes
1 answer
Is there a way to parse variables inside glue
I am trying to parse variables using glue package in R. But looks like some issue. Can anyone please help
Since my variables here will be reactive in future , I am trying to parse it using…

manu p
- 952
- 4
- 10