Questions tagged [r]

R is a free, open-source programming language and software environment for statistical computing, bioinformatics, and graphics.

Filter by
Sorted by
Tagged with
1
vote
0answers
78 views

How to set kernel size (height and width) for 1D convolution layer in CNN Keras R API for doc2vec input?

I am using a doc2vec matrix (6000,1024) as feature space to input in a classification model which can categorise each document(sentence in my case) into one of the two classes (A,B). My feature space ...
0
votes
2answers
31 views

Reading Date Time in R (01.01.2019 00:00)

How do you read a date in R that is given in the following way: 01.01.2019 00:00 While reading it with read.csv("my_file.csv", sep = ";", dec = ",") I am getting ...
0
votes
1answer
35 views

Append and replacing data in r

I am writing a few lines of codes to create a data table full of NAs but don't know how to append the data of results into the data table I created while replacing the position of NAs. Here is my data ...
4
votes
1answer
154 views

On the choice of LSTM input/output dimension for a spatio-temporal problem

I am using LSTM neural networks from (R)Keras for a matter of spatio-temporal interpolation. I manage to get the network to output predictions but the results are not outstanding (very little ...
2
votes
1answer
74 views

Difference in model performance measures of train and test data sets

I am using CART classification technique by dividing a dataset into train and test sets. I have been using Mis-classification error, KS by rank ordering, AUC and Gini as MPMs(model performance ...
3
votes
1answer
37 views

How to approach clustering of time-series with a single variable

Let me preface this by saying that I'm a complete beginner to R and data science in general, so my apologies if this is a rather trivial question. I do have a rough idea of what I would like to ...
1
vote
0answers
45 views

Kappa Goes up as Accuracy Goes Down

I have recently been trying to train a randomForest model on a binary outcome with a very uneven class split. 282 control ~82% 63 case ~18% There are a total of 147 predictors that I'm testing for ...
0
votes
2answers
42 views

Loops in R programming,

I want to update this Remaining column in this table below: How do I do this in R programming? I tried while (n.Remaining>0) { n.remaining <- n.total-n.expense} Desired Output:
1
vote
0answers
75 views

How to model non-linear demand function?

I am trying to build a dynamic pricing algorithm on intermittent data (a lot of zeros between non-zero values). I have on average 100 non-zero data points for each product. However, it seems to be ...
0
votes
1answer
75 views

Remove part of the string in R - dropping some words from it

I have a column in dataframe which should represent the date, named "taken", and looks like this: taken Sat Jan 01 15:30:27 CET 2011 Thu Jan 06 00:54:26 CET 2011 Sat Jan 08 19:49:02 CET 2011 Sun ...
0
votes
1answer
27 views

How to make a dataframe with lists or vectors as its elements

This is something I have been wondering for ages but I am never able to get an answer. I am trying to understand how to make a dataframe in R, where each element of the dataframe is itself a vector ...
0
votes
1answer
172 views

Using the Stanford Named Entity Tagger in R [closed]

I am experimenting with the Stanford Named Entity Tagger here http://nlp.stanford.edu:8080/ner/process and I feel it would be useful in my research. Does anyone know of a example that I could follow ...
2
votes
2answers
446 views

How to define a custom metric function in R for Keras?

I just started using keras and would like to use unweighted kappa as a metric when compiling my model. Following the instructions from here, I tried to define my custom metric as follows: ...
1
vote
0answers
41 views

Better way to graph percentage of One Categorical Variable by another in R

Looking through the Brfss 2013 dataset (a study that recorded many elements of an observers health habits and outcomes), I wanted to see if there was a correlation between smoking often and being an ...
3
votes
0answers
43 views

Fitting model to differenced time series

I have a time series on daily stock price of company(2013 data points).I took a first order difference and the following acf and pacf plots of the differenced series were obtained. However, I am ...
1
vote
1answer
62 views

Importing Excel format data into R/R Studio and using glmnet package?

I have no problem importing Excel formatted data into R/R Studio and use all other R packages that I use. But, when I want to use the glmnet package to develop a regularization model, I invariably ...
1
vote
1answer
38 views

How R performs the operations like Inf + Inf, Inf * Inf, Inf - Inf and Inf / Inf?

In R When we do some operation like Inf + Inf, Inf * Inf gives Inf back, whereas similar ...
2
votes
1answer
990 views

R Combine Multiple Rows of DataFrame by creating new columns and union values

I have a dataframe in R that looks like this ...
0
votes
2answers
71 views

Dataset Merging

I have several datasets (All looks like this). The Problem is, that the same user is on several datasets. I need to merge the different sets in a way, that if the username is the same, the frequencies ...
0
votes
1answer
27 views

LDA as a dimensionality reducer [closed]

I know how to use LDA as a classifier. But how to use Linear Discriminant Analysis as a dimensionality reducer to reduce the number of features and apply logistic regression on top of it. I am using R ...
0
votes
1answer
2k views

How to resolve “invalid number of 'breaks'”

Code: f_custdata <- gsub(".", "", f_custdata) f_custdata <- as.numeric(f_custdata) hist(f_custdata) Error: Error in hist.default(f_custdata) : ...
1
vote
0answers
141 views

Creating word cloud with positive and negative words

Have already load in the lexicon to score my tweets. How do I create a word cloud for the tweets that are negative only? ...
0
votes
1answer
87 views

Clustering by Distributions of Groups of observations

I have data as shown below. Like the groups shown A,B,C.. there are roughly 5400 groups of data and 15 observations for every group (I sampled 6-7 for each group and pasted them here). ...
1
vote
0answers
52 views

Dummy variables for unseen data in R

I got the following problem: When I trained my model I created my dummy variables(before train-test split) in the following way: ...
1
vote
1answer
417 views

Mutate with dynamic column names dplyr

Hi I have this dataset (It has many more columns) ...
3
votes
1answer
219 views

Overfitting - how to detect it and reduce it?

I have a side project where I am doing credit scoring using R (sample size around 16k for train data and 4k for test data, and also another two 20k data batches for out-of-time validation) with ...
1
vote
1answer
141 views

Hierarchical Clustering and Variable Selection

I am using "Single linkage" hierarchical algorithm to cluster my data points with Gower Distance as my data have both qualitative and quantitative variables. After applying this for the full ...
0
votes
1answer
252 views

Categorical data into numeric in excel

I have a large dataset and I would like to convert these categorical data into numeric in binary form to perform k means clustering in R. However, I get an error in value. This is the formula that I ...
1
vote
1answer
69 views

Linear regression model with (categorical) predictor variables

I used LM model with (categorical) predictor variables on my data in r like this (I have count variable as dependent/target variable): ...
4
votes
2answers
3k views

Additive vs Multiplicative model in Time Series Data

The above time series plot is a daily closing stock index of a company. I want to know which model between additive and multiplicative best suits the above data. I know what the two models are, but i ...
1
vote
1answer
409 views

Kmean clustering on text data

I have a large raw dataset on crime and I want to cluster the data using k-means, However, I get an Error when I enter this code: ...
1
vote
1answer
95 views

Column header in XTS and Data frame in R

I used quandl function extract stock data with object type as xts. ...
1
vote
1answer
134 views

Get insights from Random forest::Variable Importance analysis

I run variable importance on my Panel data (TV viewing over specific period) which consists of the old-Panel (Panel 0) and the new panel (Panel 1) I am interested in understanding the differences in ...
2
votes
3answers
54 views

which classification model allows user to choose importance of data inputs?

I am working on a match analytics project where I have to deal with the situation in which I am having some inputs like skills, experience, certifications etc. and my output is candidate selected Yes ...
2
votes
1answer
52 views

Gracefully removing observations with outliers in N fields

I have a function. ...
2
votes
2answers
254 views

Analysis of Time Series data

The below graph is a scatterplot of daily stock price. My aim is to predict future stock price of the company. From the scatterplot it seems that it is a multiplicative model, so I tried to "...
0
votes
1answer
41 views

Remove specific words containing dots from a string

Hi I got words that contain one of the following tokens: CO. PRO. IST. How to clean my words from these tokens? Do you have any regex pattern? for example the words : ...
2
votes
1answer
713 views

R NbClust for Python?

Is somebody know a Python equivalent to R NbClust? I'm searching for a way to determine the optimal clusters number for many 'similar datasets' and NbClust sounds good but it's for R and i'm a Python ...
1
vote
1answer
26 views

Creating trial number ascending list, for separate subjects in long format data frame, R?

I have a very long data frame (over 300 000 rows), consisting of all subjects trials of a task, in long format. So about 300 rows is successive trials for one subject, followed by the other subjects ...
2
votes
0answers
54 views

ML/Statistical Model to Analyse the Distribution

Consider a Sample Data-set provided below; ...
2
votes
1answer
1k views

Is there an R tutorial of using LSTM for multivariate time series forecasting?

There is a great blog post about how to use keras stateful LSTM in R to forecast sunspots. I applied it to financial ts data ...
0
votes
0answers
14 views

How to apply curve fitting on both completed and active data?

Suppose we have a set of part failure times on which a specific curve (e.g. gamma distribution) is already fitted. Then another set of times are given where the part is still active (not failed yet). ...
1
vote
1answer
31 views

Display a subset of classes in axes in ggplot

I have the following plot, is there any way in ggplot to display just the numbers 1 to 10 instead of all of them? Numbers from 10 and after are not so important, but I need to display the ones before. ...
1
vote
1answer
29 views

Map a number to a string [closed]

I have vector c(1,3,4,5,7). I want convert it in this way: c('apple','pie','nuts','cookies','some_other_class') Do you have any short ways to do it? Like a switch method or something like that?
1
vote
1answer
1k views

Weighted mean with summarise_at dplyr

I strictly need to use the summarise_at to compute a weighted mean, with weights based on the values of another column ...
0
votes
0answers
12 views

DocumentTerm Matrix Clustering Suggestions

I am trying to use NLP-style techniques to create clusters of similar books based on their "taglines" or "synopses". The problem I am having is that for many of the synopses, only one word is common. ...
2
votes
1answer
60 views

What Machine Learning Algorithm could I use to determine some measure in a date?

I am getting stuck with this problem. Let's say that we have the next information. CustomerID: 1, Date: 3/2/2018, Quantity: 3, Total: 390.78, Min: 130.26, Max: 130.26 We want to determine given a ...
3
votes
1answer
5k views

Cutting numbers into fixed buckets

I am trying to put numeric data into fixed number of buckets using Python/R. I have data in key:value format ...
1
vote
1answer
319 views

Divide a column by itself with mutate_at dplyr

Hi I'd like to turn each non zero value of my selected columns to a 1 using mutate_at() ...
0
votes
1answer
30 views

The proper way to codify Na in a list in R

I am trying to impute missing timeseries present in different dimentions, row by row, on the whole date set. I showed the type of return of na.kalman() and it ...