[R] package.skeleton, environment argument causes error

2016-08-18 Thread Jacob Strunk
Hello, I have been using package.skeleton from within an lapply statement successfully (assuming good source code) with the following setup in the past: x=try(package.skeleton(package_name,path=pathi,code_files=file_i)) but now fails with error: Error: evaluation nested too deeply: infinite rec

Re: [R] Regressing the residuals on the country dummies

2016-08-18 Thread Bert Gunter
1. Have you checked out package Rpy/Rpy2? 2. I don't know Python, but as you seem to be trying to get data from the web, see the Rcurl package, maybe, to do these things in R. 3. Hopefully someone who does know Python can give you better answers. Cheers, Bert Bert Gunter "The trouble with ha

Re: [R] Regressing the residuals on the country dummies

2016-08-18 Thread Alemu Tadesse
Thank you Bert. Both rpy and ypy2 are to use R in python. I have never seen a package (that works) to call python script in R. Best, Alemu On Thu, Aug 18, 2016 at 1:09 PM, Bert Gunter wrote: > 1. Have you checked out package Rpy/Rpy2? > > 2. I don't know Python, but as you seem to be trying t

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread John Dougherty
On Thu, 18 Aug 2016 09:19:05 + Barathan Roy Pinas wrote: > Hello, > > > I have been given a .csv file and it is not loading. This is what I > did. > > > survey=read.csv("http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.csv";) > attach(survey) > pulse.sf=pulse[smoke==1 & sex==2] > pu

Re: [R] remove rows based on row mean

2016-08-18 Thread Adrian Johnson
Wow. This is much cleaner and smarter than the for loop, cbind thanks a lot . On Thu, Aug 18, 2016 at 6:28 PM, Jim Lemon wrote: > Hi Adrian, > Try this: > > sm$rowmeans<-rowMeans(sm[,2:length(sm)]) > sm<-sm[order(sm$Gene,sm$rowmeans,decreasing=TRUE),] > sm[-which(duplicated(sm$Gene)),] > > Jim >

Re: [R] remove rows based on row mean

2016-08-18 Thread jeremiah rounds
oh I forgot I renamed sm. dt = sm library(data.table) setDT(dt) op = function(s){ mean0 = apply(s, 1, mean) ret = s[which.max(mean0)] ret$mean = mean0 ret } max_row = dt[, op(.SD), by = "Gene"] Thanks, Jeremiah On Thu, Aug 18, 2016 at 3:21 PM, jeremiah rounds wrote: > library(data.table) > se

Re: [R] remove rows based on row mean

2016-08-18 Thread Jim Lemon
Hi Adrian, Try this: sm$rowmeans<-rowMeans(sm[,2:length(sm)]) sm<-sm[order(sm$Gene,sm$rowmeans,decreasing=TRUE),] sm[-which(duplicated(sm$Gene)),] Jim On Fri, Aug 19, 2016 at 7:33 AM, Adrian Johnson wrote: > Hi Group, > I have a data matrix sm (dput code given below). > > I want to create a da

Re: [R] remove rows based on row mean

2016-08-18 Thread jeremiah rounds
library(data.table) setDT(dt) op = function(s){ mean0 = apply(s, 1, mean) ret = s[which.max(mean0)] ret$mean = mean0 ret } max_row = dt[, op(.SD), by = "Gene"] Thanks, Jeremiah On Thu, Aug 18, 2016 at 2:33 PM, Adrian Johnson wrote: > Hi Group, > I have a data matrix sm (dput code given below).

[R] remove rows based on row mean

2016-08-18 Thread Adrian Johnson
Hi Group, I have a data matrix sm (dput code given below). I want to create a data matrix with rows with same variable that have higher mean. > sm Gene GSM529305 GSM529306 GSM529307 GSM529308 1A1BG 6.57 6.72 6.83 6.69 2A1CF 2.91 2.80 3.08 3.00

[R] rhive with PAM

2016-08-18 Thread Divakar Reddy
Hi, Can you help me on this? Can we implement PAM authentication for rhive? If yes, Can you suggest me if you have any documentation? Is rhive going to use RODBC/JDBC connection to connect hiveserver2? or requests directly going to namenode? Here are my connection details: library(RODBC)

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Bob Rudis
Ulrik: you can absolutely read from a URL in read.csv() with that syntax. The error `## Error in attach(survey): object 'survey' not found` suggests that the OP mis-typed something in the `survey` name in the assignment from `read.csv()`. However, the OP has quite a bit more to be concerned about

Re: [R] Regressing the residuals on the country dummies

2016-08-18 Thread Alemu Tadesse
Dear All, I am wondering if someone knows an R equivalent of the following API call in python. "-" import time import pandas as pd start_time = time.clock() timer =time.clock() import pkg_resources pkg_resources.require("pysimplesoap==1.05a") from pysimplesoap.client import SoapClient impo

Re: [R] loop function

2016-08-18 Thread Adams, Jean
You seemed to have re-written over the "b" object in your code. This might work for you. library(MASS) for (i in 58:1){ for(j in 58:i){ str.temp <- paste("y1 ~ x", i, "* x", j, sep = "") univar <- glm.nb(as.formula(str.temp), data=df) b <- summary(univar)$coeffients[4, 4] if(b <

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Ulrik Stervbo
Thanks for clarifying Bob Rudis schrieb am Do., 18. Aug. 2016 19:41: > Ulrik: you can absolutely read from a URL in read.csv() with that syntax. > > The error `## Error in attach(survey): object 'survey' not found` > suggests that the OP mis-typed something in the `survey` name in the > assignme

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Clint Bowman
After: survey <- read.csv(file="http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.csv";) do: summary(survey) then bone up on "attach" and "with". Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Departm

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Ulrik Stervbo
I don't think you can read files into R like that. This answer http://stackoverflow.com/questions/3236651/read-data-from-internet on Stack Overflow tells you, you could use the RCurl package. Here are more examples on getting data from online sources https://www.r-bloggers.com/getting-data-from-an

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Duncan Murdoch
Sorry, we don't do homework on this list. You should ask your instructor. Duncan Murdoch On 18/08/2016 5:19 AM, Barathan Roy Pinas wrote: Hello, I have been given a .csv file and it is not loading. This is what I did. survey=read.csv("http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.

[R] [R-pkgs] have a look over package "imputeTestbench"

2016-08-18 Thread Neeraj Dhanraj
Hi Friends, Have a look over R package "imputeTestbench". It provides a Test bench for comparison of missing data imputation models/methods. It compares imputing methods with reference to RMSE, MAE or MAPE parameters. It allows to add new proposed methods to test bench and to compare with other me

[R] loop function

2016-08-18 Thread fatimah soleimany
Hi Dear users, for an interactive use, i am trying to write a loop that looks for all variables in the conditions which i introduced, this is what I'm trying: library(MASS)> i=1> for (i in 58:1){+ for(j in 58:i){+ + str.temp <- paste("y1 ~ x", i, "* x", j, sep = "")+ univar<-glm.nb(as.formula(str.

[R] Retrieving data from survey in R Studio

2016-08-18 Thread Barathan Roy Pinas
Hello, I have been given a .csv file and it is not loading. This is what I did. survey=read.csv("http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.csv";) attach(survey) pulse.sf=pulse[smoke==1 & sex==2] pulse.sf Template link here.

Re: [R] optimize the filling of a diagonal matrix (two for loops)

2016-08-18 Thread Thomas Mailund
  The nested for-loops could very easily be moved to Rcpp which should speed them up. Using apply functions instead of for-loops will not make it faster; they still have to do the same looping. At least, when I use `outer` to replace the loop I get roughly the same speed for the two versions —

Re: [R] Error while fitting gumbel copula

2016-08-18 Thread Isaudin Ismail
Dear Martin, Following my earlier question on "error while fitting gumbel copula", I have also crated a new gist at https://gist.github.com/anonymous/ 0bb8aba7adee550d40b840a47d8b7e25 for easy checking and copying codes. I got no problem fitting other Archimedean copulas except gumbel copula as p

[R] optimize the filling of a diagonal matrix (two for loops)

2016-08-18 Thread AURORA GONZALEZ VIDAL
Hello I have two for loops that I am trying to optimize... I looked for vectorization or for using some funcions of the apply family  but really cannot do it. I am writting my code with some small data set. With this size there is no problem but sometimes I will have hundreds of rows so it is real

[R] Announcement of optimr and optimrx packages

2016-08-18 Thread ProfJCNash
Package __optimr__ is now on CRAN, and a more capable package __optimrx__ is on R-forge at https://r-forge.r-project.org/R/?group_id=395 These packages wrap a number of tools for function minimization, sometimes with bounds constraints or fixed parameters, but use a consistent interface in functi

[R] Need help with output of Proximus algorithm

2016-08-18 Thread Matej Zuzčák
Hello list members, I have question about output of PROXIMUS algorithm. In the example of use here: https://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/Proximus#Algorithm in Case Study section is all clear, but I do not know what way they use for get clustered words to groups: Gro

Re: [R] Error in riv package

2016-08-18 Thread Shivi Bhatia
Hi Ista, Thanks for your reply. I had added a detailed explanation on this one & researched before asking. May be someone did not read it i cant do much though David's explanation helped as why it wasnt able to run the syntax. Please see trail mail: (though i have already moved ahead and taken an

Re: [R] get() within function

2016-08-18 Thread Ivan Calandra
Thank you Thomas, Because of the error message, I focused only on get()... My bad! Ivan -- Ivan Calandra, PhD Scientific Mediator University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.calan...@univ-reims.fr -- https

Re: [R] get() within function

2016-08-18 Thread Thomas Mailund
  Hi Ivan, ls() inside a function gives you the variables in the local scope. If you want to get the variables defined in the global scope you need to tell ls() that. Check the difference between these three functions: > foo <- function() ls() > foo() Returns character(0) because there are no

[R] get() within function

2016-08-18 Thread Ivan Calandra
Dear useRs, For an interactive use, I am trying to write a function that looks for all data.frames and lists in the environment and ask the user to select one of them. I then run some operations on this object. This is what I am trying: foo <- function(){ df.list <- ls()[sapply(ls(), fun