Questions tagged [coerce]
73 questions
1
vote
1 answer
googleAnalyticsR package cannot coerce type 'closure' to vector of type 'character'
When I run the following code I see no error and the Shiny app renders and performs as expected.
library(shiny)
library(googleAuthR)
gar_set_client(scopes = c("htps://www.googleapis.com/auth/analytics.readonly"))
library(googleAnalyticsR)
ui <-…

jimiclapton
- 775
- 3
- 14
- 42
1
vote
2 answers
as.numeric("10^3") Warning message: NAs introduced by coercion
Trying to coerce this vector as numeric:
vec <- c("10^2", "10^3", "10^6", "", "10^9")
vec <- as.numeric(vec)
[1] NA NA NA NA NA
Warning message:
NAs introduced by coercion
Output desired:
[1] "100" "1000" "1e+06" "" "1e+09"

Danilo Correa
- 111
- 9
1
vote
2 answers
coerce function in common lisp -- arrays and lists
I am seeing different behavior of coerce between different versions of Common Lisp - wondering which one is "right" or is the standard ambiguous on this seemingly simple question:
is
(coerce '(1 2 3) 'array)
correct lisp? It works fine in Clozure…

PaulM
- 305
- 1
- 8
1
vote
1 answer
Using Deriving Via with Phantom Types
Apologies for the long repro but I haven't been able to make it any shorter. The following code compiles fine until the last line:
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
{-#…

Julian Birch
- 2,605
- 1
- 21
- 36
1
vote
2 answers
Coercing multiple time-series columns to factors in large dataframe
I would like to know if there is an "easy/quick" way to convert character variables to factor.
I am aware, that one could make a vector with the column names and then use lapply. However, I am working with a large data frame with more than 200…

rica
- 67
- 1
- 9
1
vote
1 answer
How can I make data uploaded to a shiny app usable and then actually use it?
I'm trying to build a shiny app and I've never done this before.
What I want to do is allow the user to upload data from a CSV file of the user's choice that looks something like this:
ID Date Name Amount
123 01/12/2018 John Doe …

Jennifer B.
- 163
- 1
- 4
- 10
1
vote
1 answer
APCluster Error in as.vector(data): no method for coercing this S4 class to a vector
Using an unclustered input data frame (fci), an APResult is created from apcluster() as epxected:
> apclr2q02 <- apcluster(negDistMat(r=2), fci)
> show(apclr2q02)
APResult object
Number of samples = 1045
Number of iterations = 826
Input…

Dennis
- 51
- 1
- 4
1
vote
1 answer
Unlist a dataframe variable in R
I have a dataframe bask.df as below.
basko1 basko2
1st 6 1
2nd 12 1
3rd 8 8
4th 4 5
5th 1 2
6th 8 9
7th 1 2
8th 8 9
9th 12 14
10th 15 …

Sarang Manjrekar
- 1,839
- 5
- 31
- 61
1
vote
2 answers
How to print numbers as floats with a specified format in lisp?
An arbitrary number can be readily converted to float with some number of decimals. For example, using (format nil "~,2f" 6) gives "6.00". But is there a way to directly coerce an arbitrary number using an analogous float type spec; i.e., outputting…

davypough
- 1,847
- 11
- 21
1
vote
1 answer
Unable to coerce nested sized to unsized type using CoerceUnsized
I am trying to use the functionality of CoerceUnsized:
use std::rc::Rc;
use std::borrow::Borrow;
fn main() {
// Create (sized) i32 wrapped in an rc.
let a0: Rc = Rc::new(0i32);
// Coerce to (unsized) Borrow wrapped in an rc.
…

Pentagolo
- 121
- 6
1
vote
0 answers
Coerce output of mapply function to dataframe R
library(verification)
Given several experiments (AA,BB,...,), I can run my code as follows using this reproducible example:
##################### EXPERIMENT AA
#my data in reality is continuous but I convert it to binary using a threshold…

code123
- 2,082
- 4
- 30
- 53
1
vote
1 answer
WPF DependencyProperty event before content changed
First I will explain the context of the problem, because you might be able to point me in a better direction.
I need to implement a undo-redo like system on an object. The object has a series of dependency properties. Some are double, int, string…

morsanu
- 975
- 20
- 35
1
vote
1 answer
R coerce character vector into character and numeric
I have a vector:
> vek
[1] "0" "0" "NULL" "0" "0" "0" "0" "NULL"
I want to coerce vector into numeric, where is numer and string, where is string
> vek
[1] 0 0 "NULL" 0 0 0 0 "NULL"
Is it possible? How can I…

Marta
- 3,493
- 6
- 28
- 43
1
vote
1 answer
Oracle: Coercing VARCHAR2 and CLOB to the same type without truncation
In an app that supports MS SQL Server, MySQL, and Oracle, there's a table with the following relevant columns (types shown here are for Oracle):
ShortText VARCHAR2(1700) indexed
LongText CLOB
The app stores values 850 characters or less in…

enigment
- 3,316
- 7
- 30
- 35
0
votes
1 answer
How to coerce a truth table into a dataset or in tibble
I have a dataset where I am training on to coerce as dataset (foundable in the onòy in SetMethods package)
library(QCA)
library(SetMethods)
data(SCHF)
# Get the truth table for the presence of the outcome:
TT_y <- truthTable(SCHF, outcome =…

12666727b9
- 1,133
- 1
- 8
- 22