Category "r"

problem with classes when scraping tripadvisor with rvest

I am trying to scrape tripadvisor reviews. I use the code trip_ad <- read_html("http://www.tripadvisor.com/Hotel_Review-g189400-d10798588-Reviews-Electra_Met

Plot Layout of Base R Plots Saved by recordPlot() Function

I can use the recordPlot() function to save Base R plots in data objects: plot(1:5, 1:5) my_plot1 <- recordPlot() plot(1:10, 1:10) my_plot2 <- recordPlot

Adding a column, of which the values depend on whether the value in another column, matches one of four vectors

I have data as follows: library(stringi) datfake <- as.data.frame(runif(100, 0, 3000)) names(datfake)[1] <- "Inc" datfake$type <- sample(LETTERS, 100,

Difference in R and SPSS LMM output

I am working on a linear mixed model and am attempting to run one on the same data in r and spss. I'm using a treatment with two levels, looking at 10 different

RMarkdown slidy presentation: tabset?

I am looking for a way to use {.tabset} in an RMarkdown Slidy presentation, but the tabs are not created and it just lists everything sequentially on the slide.

Error in as.vector(data) : no method for coercing this S4 class to a vector in R

I am trying to run volatility from GARCH model: Used libraries: source("TimeSeriesFunctions.R") library(PerformanceAnalytics) library(fGarch) library(MonteCa

ggplot2 geom_point position= "dodges" doesn't match the error bar dodge

Im trying to figure out the best way to plot changes in water potential through summer comparing two factors, soil cover treatments and irrigation. I reached a

Highcharts bubble map does not always render properly

I have created a shiny app, which displays a highchart Map. With a select input, one can choose specific countries that one wants to be displayed. Most of the t

R find all possible unique combinations

I am trying to find all possible unique combinations in R. It seems that there have been a lot of similar questions asked, but I was not able to find the same o

error: 'predictions' contains NA while predict landuse change using glm model (lulcc package) in R

I made a prediction model for land use change using the lulcc package in R. Prediction was done using glm. When I did the glm.pred (the last line), there was an

RcppEigen package "#pragma clang diagnostic pop" warnings

I am having some trouble when trying to use the RcppEigenpackage. I used the example posted here. The function worked, but R generated a series of similar warni

Identifying lead/lags using multivariate regression analysis

I have three time-series variables (x,y,z) measured in 3 replicates. x and z are the independent variables. y is the dependent variable. t is the time variable

Is there a way to convert Python to R?

Hey I am trying to convert my python code to R and can't seem to figure out the last part of the recursion. If anyone who has experience in both languages could

Is there a way to convert Python to R?

Hey I am trying to convert my python code to R and can't seem to figure out the last part of the recursion. If anyone who has experience in both languages could

Replace values conditionally, better way

I have a large dataframe with city names and many are misspelled. Right now I have corrected then manually, one by one, using the following code: geo <- geo

sparkR sql() returns string

We have parquet data saved on a server and I am trying to use SparkR sql() function in the following ways df <- sql("SELECT * FROM parquet.`<path to parq

Cache data in Shiny Server on Docker

I am currently trying to implement caching on my dockerized shiny app, but i am facing troubles, the app doesn't work and there's no log to trace the problem: S

Add 'total' row for each group in a column in df

I have a dataframe where the column size can be grouped. When the dataframe is arranged by size, I would like to show the totals of each column for each group a

R shiny datable with styleColorBar not aligning the data on the left hand side

I have the following code and my goal is to add styleColorBar to the WGT column, aligning the yellow bars on the left hand side of the column. df = data.frame(W

Fitting a line to the mean values of a multilevel variable using geom_smooth

I have this dataframe. I create a plot representing on the y-axis "value" and on the x-axis each of the levels of "Column_S", which contains levels from S1 to S