gvlma doesn't return the GlobalTest component

I want to test the assumptions of linear regression for a dataset. Here's my code: reg <- lm(est~emp_app, temp) gvlma::gvlma(reg) which returns: Call: lm(formula = est ~ emp_app, data = temp) Coefficients: (Intercept) emp_app -639.17...
more »

2017-10-14 12:10 (1) Answers

Using Apply Function in R as alternative to Loop

Looking for help. I am looking to create a balance build whereby the start balance in each row is dependent on the end balance from the preceeding row. The End Balance in the preceeding row is a calculation: End Balance = Start Balance + Payments - ...
more »

2017-10-13 14:10 (0) Answers

scraping - limited search results availability

So I wanted to have some used-cars price database to do some data analysis across various brands, countries, fuel types etc. I found couple of websites that have this information and extracted some data. But I also wanted to extract data from autosc...
more »

2017-10-13 14:10 (0) Answers

Read.csv importing integers in R

Im importing a csv into R and one of the columns is full of emails, i don not know why is being imported as integer =( and when i apply as.character to the column it erase some of the emails ...
more »

2017-10-13 03:10 (1) Answers

R: How to replace rows in a table by mean values

Sorry, I am probably using the wrong search terms but I couldn't find a solution. Given an experiment with two participants (id), each performing a task 6 times under two varying parameters (par1,par2): id <- c(rep(1,6),rep(2,6)) par1 <- c(...
more »

2017-10-13 00:10 (2) Answers

Issue with when plotting `density` objects

I have an issue when trying to plot density objects. Consider for example require(grDevices) set.seed(43) d0 = density(rexp(1e5,rate=1)) d1 = density(rexp(1e5,rate=1.8)) plot(d1, col="white", xlab = "x", ylab="Density", main = "") polygon(d1, col...
more »

2017-10-12 23:10 (2) Answers

Nodes not respecting facetting in ggraph/igraph

I am having a little trouble understanding the difference between ggplot2 and ggraph with respect to facetting. Consider the following data: library(igraph) library(ggraph) library(ggplot2) df <- structure(list(x = c("H001", "H024", "H090", "H0...
more »

2017-10-12 23:10 (2) Answers

Extract documentation from an r package

I'm trying to write an R function which will extract exported functions from an R package and return a list containing for each function, the call signature, and the description from documentation. Getting the list of exported functions can be done ...
more »

2017-10-12 15:10 (1) Answers

Syntax of for loops in R

I'm coming over to R from Stata and have a simple syntax question that I haven't been able to solve. I'm trying to loop across multiple currencies (GBP EUR JPY) to make an exchange rate adjustment. For each record denominated in one of the currencies...
more »

2017-10-11 21:10 (2) Answers

r exclude sentences with keywords

I am dealing with sentences that are as follows Has no anorexia She denies anorexia Has anorexia Positive for Anorexia My goal is to exclude sentences that have words like denies, denied, no and retain only the positive indication ...
more »

2017-10-11 20:10 (2) Answers

R function parameter tooltip

Firstly, my apologies for some amateur questions: I am attempting to package R functions following Building R package and roxygen documentation The functions are visible to other projects with its documentation when querying with ?. However, I am h...
more »

2017-10-11 18:10 (0) Answers

column replaced in R

I have the following data.frame, dt2017 <- data.frame(id=LETTERS[1:4],year=2017,city1=c(0,1,0,1),city2=c(0,0,1,0), city3=c(1,0,1,0),city4=c(0,0,0,0)) dt2017 id year city1 city2 city3 city4 1: A 2017 0 0 1 ...
more »

2017-10-11 05:10 (2) Answers

R Data wrangling

I am new to R, I have a csv file that contains values: A, , , ,B, , , ,C1, , , ,D1 , , ,D2 , ,C2, , , ,D3 , , ,D4 Loading the data into a data frame: dat = read.csv("~/RData/test.csv", header = FALSE) dat # V1 V2 V3 V4 # 1 A # 2 B...
more »

2017-10-10 16:10 (2) Answers

Group_by then filter with dplyr

First of all, please let me know if what I'm doing is poor use of dplyr because I'm not sure if I'm approaching this in the best way. I have the following dataframe: mydf = data.frame(user = c(7,7,7,7,7,7,7,8,8,8,8,8,8), col1 = c('...
more »

2017-10-10 08:10 (4) Answers