r

Linear Regression prediction in R using Leave One out Approach

寵の児 提交于 2021-02-18 19:51:34
问题 I have 3 linear regression models built using the mtcars and would like to use those models to generate predictions for each rows of the mtcars tables. Those predictions should be added as additional columns (3 additional columns) of the mtcars dataframe and should be generated in a for loop using the leave one out approach. Furthermore predictions for model1 and model2 should be performed by "grouping" the cyl numbers whiles predictions made with the model 3 should be accomplished without

Linear Regression prediction in R using Leave One out Approach

ぃ、小莉子 提交于 2021-02-18 19:51:30
问题 I have 3 linear regression models built using the mtcars and would like to use those models to generate predictions for each rows of the mtcars tables. Those predictions should be added as additional columns (3 additional columns) of the mtcars dataframe and should be generated in a for loop using the leave one out approach. Furthermore predictions for model1 and model2 should be performed by "grouping" the cyl numbers whiles predictions made with the model 3 should be accomplished without

Run R script after input in Shiny

我与影子孤独终老i 提交于 2021-02-18 19:45:23
问题 Good morning everyone, I have a Shiny application that collects 5 inputs from the users and stores them into variables. Then, I would be able to use another R script that would run based on the information provided by the user. Here is a sample of my Shiny App : jscode <- "shinyjs.closeWindow = function() { window.close(); }" #Define UI for application ui <- pageWithSidebar( #App title headerPanel("Filters applied for Powerpoints"), #Panel to display the filters sidebarPanel( #Select dates

Removing rows containing specific dates in R

你说的曾经没有我的故事 提交于 2021-02-18 19:34:40
问题 Disclaimer: I am going to come out of this looking silly. I have a data frame containing a column which has a date of class POSIXct . I am trying to remove some of the rows containing specific dates- public holidays. I tried to do that using this: > modelset.nonholiday <- modelset[!modelset$date == as.POSIXct("2013-12-31")| !modelset$date ==as.POSIXct("2013-07-04") | !modelset$date == as.POSIXct("2014-07-04")| !modelset$date == as.POSIXct ("2013-11-28") | !modelset$date == as.POSIXct ("2013

Removing rows containing specific dates in R

我只是一个虾纸丫 提交于 2021-02-18 19:33:47
问题 Disclaimer: I am going to come out of this looking silly. I have a data frame containing a column which has a date of class POSIXct . I am trying to remove some of the rows containing specific dates- public holidays. I tried to do that using this: > modelset.nonholiday <- modelset[!modelset$date == as.POSIXct("2013-12-31")| !modelset$date ==as.POSIXct("2013-07-04") | !modelset$date == as.POSIXct("2014-07-04")| !modelset$date == as.POSIXct ("2013-11-28") | !modelset$date == as.POSIXct ("2013

1-dimensional Point-Process in R (spatstat)

拈花ヽ惹草 提交于 2021-02-18 19:33:32
问题 I have asked another question, which was closed as Too Broad. Now, I will try to specify. Again, I would like to simulate a 1-dimensional point process in R. So far, I've only been working on 2-dimensional simulations and would need a bit of help. My goal is a simulation like in the picture But, I only need the real line with the random points on it. I use spatstat and have already found out that I can generate random points on a 1-dim Line with: rpoisppOnLines(lambda, L, lmax = NULL, ...,

Linear regression on raster images - lm complains about NAs

喜你入骨 提交于 2021-02-18 19:13:46
问题 I'm sure this can be fixed with few bytes, but I've spent hours on this simple thing and can't get out of it. I don't use R often. I have 5 asciigrid files that represent 5 raster images. Some pixels do have values, other do have NAs. For example, the first image might be something like: NA NA NA NA NA NA NA 2 3 NA NA 0.2 0.3 1 NA NA NA 4 NA NA and the second might be: NA NA NA NA NA NA NA 5 1 NA NA 0.1 12 12 NA NA NA 6 NA NA As you can see, NA position is always the same and I'm 100% sure

Linear regression on raster images - lm complains about NAs

喜欢而已 提交于 2021-02-18 19:10:28
问题 I'm sure this can be fixed with few bytes, but I've spent hours on this simple thing and can't get out of it. I don't use R often. I have 5 asciigrid files that represent 5 raster images. Some pixels do have values, other do have NAs. For example, the first image might be something like: NA NA NA NA NA NA NA 2 3 NA NA 0.2 0.3 1 NA NA NA 4 NA NA and the second might be: NA NA NA NA NA NA NA 5 1 NA NA 0.1 12 12 NA NA NA 6 NA NA As you can see, NA position is always the same and I'm 100% sure

Rpy2: pandas dataframe can't fit in R

杀马特。学长 韩版系。学妹 提交于 2021-02-18 19:06:14
问题 I need to read a csv file with python (into a pandas dataframe), work in R and return to python. Then, to pass pandas dataframe to R dataframe I use rpy2, and work ok (code bellow). from pandas import read_csv, DataFrame import pandas.rpy.common as com import rpy2.robjects as robjects r = robjects.r r.library("fitdistrplus") df = read_csv('./datos.csv') r_df = com.convert_to_r_dataframe(df) print(type(r_df)) And this output is: <class 'rpy2.robjects.vectors.FloatVector'> But then, I try to

Open Link on Datapoint Click with Plotly in R Shiny

☆樱花仙子☆ 提交于 2021-02-18 19:01:19
问题 I'm working with Plotly in R to develop a Shiny web app. I've put together an interactive scatterplot and configured the hovertext with the information I want. My implementation is as follows: plot_ly(data=partition, x=~get(x), y=~get(y), color=~SenderS, colors="Set1", text=~paste("Link(s): <a href='", partition$Link,"'>", partition$Link, "</a>", "<br>Date: ", partition$Date, "<br>Parties: ", partition$SenderS, " to ", partition$Target, "<br>", x_og, ": ", partition[,x], "<br>", y_og, ": ",