Re: [R] How can I make my functions run faster

2013-08-19 Thread Heramb Gadgil
Greetings, Thanks Jeff. I appreciate your 'to the point' explanation. Will read into it more. Best, Heramb Gadgil 2013/8/19 Jeff Newmiller > 1. Keeping the number of variables down encourages you to structure your > data, which allows you to re-use code more efficiently.

Re: [R] How can I make my functions run faster

2013-08-19 Thread Heramb Gadgil
mpact everything in minimum number of functions 4. The in-memory of R is just 10% of your total RAM (Correct me if wrong). Make sure most of it is used for processing and not storing Hope this will help. Kindly suggest if I have misunderstood anything. Thanks and Regards, Heramb Gadgil 2013/8/1

Re: [R] how to get a value from a list (using paste function)?

2012-12-27 Thread Heramb Gadgil
;- "B" > > cvtest[[lambda.rule]] > NULL > > lambda.rule <- "Bozo" > > cvtest[[lambda.rule]] > [1] 2 > > lambda.rule <- "Joe's Test" > > cvtest[[lambda.rule]] > [1] 3 > > Also, I find it hard to read code involv

Re: [R] how to get a value from a list (using paste function)?

2012-12-27 Thread Heramb Gadgil
est[[lambda.rule]] is > much easier to read and understand than > eval(parse(text=paste0("cvtest$",lambda.rule))) > > > On 27.12.2012, at 11:44, Heramb Gadgil wrote: > > > I am not sure why "Never ever!" > > > > Can you please elaborate. What are the ne

Re: [R] how to get a value from a list (using paste function)?

2012-12-27 Thread Heramb Gadgil
I am not sure why "Never ever!" Can you please elaborate. What are the negatives about the method Warm Regards, Heramb M. Gadgil On Thu, Dec 27, 2012 at 3:50 PM, Uwe Ligges wrote: > > > On 27.12.2012 08:09, Heramb Gadgil wrote: > >> eval(parse(text=paste0("**

Re: [R] how to get a value from a list (using paste function)?

2012-12-26 Thread Heramb Gadgil
eval(parse(text=paste0("cvtest$",lambda.rule))) I hope this works. On Wed, Dec 19, 2012 at 12:57 AM, Thomas Stewart wrote: > Soyeon- > > A possible solution: > > get(lambda.rule,envir=list2env(cvtest)) > > > On Tue, Dec 18, 2012 at 12:34 PM, Soyeon Kim wrote: > > > Dear my R friends, > > > > I

Re: [R] how to read different files into different objects in one time?

2012-12-26 Thread Heramb Gadgil
You can try this one too. #Set the directory to a path where all the files to be read are stored TabletoRead=list.files(pattern=".txt") I_Step=unlist(lapply(TabletoRead,function(tab){ srno<<-ifelse(exists("srno"),(1+srno),1) Temp=read.table(tab,header=T,s

Re: [R] Renaming column names according to another dataframe

2012-12-26 Thread Heramb Gadgil
try this: colnames(df)<-df_names[1:ncol(df),"name"] On Sun, Dec 23, 2012 at 8:41 PM, radhi wrote: > Hi, I've got a dataframe having a code as column name. Addtionally I have > another dataframe with a two columns (and lots of rows), the first > containing the code and the second some Text (real

Re: [R] install.packages on windows

2012-10-01 Thread Heramb Gadgil
You can look for different versions of that package and try manually installing the lower version. On Fri, Sep 28, 2012 at 11:25 PM, Uwe Ligges < lig...@statistik.tu-dortmund.de> wrote: > > > On 28.09.2012 00:32, Duncan Murdoch wrote: > >> On 12-09-27 2:53 PM, Anju R wrote: >> >>> Sometimes when

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Heramb Gadgil
We can have something like this; *Data1<-data.frame(Site1=c(5,NA,4),Site2=c(3,2,4),Site3=c(NA,5,NA)) Data2<-data.frame(TraitType1=c(1,2,3),TraitType2=c(2,4,2),TraitType3=c(5,1,1)) * *rownames(Data1)<-paste("Species",1:3)* *rownames(Data2)<-paste("Species",1:3)* *User_Defined=function(dat1,dat2

Re: [R] mapping data from table to .csv template

2012-09-25 Thread Heramb Gadgil
Try the following code. It is basic but effective; *setwd("/home/user2/Documents")* *Test_matrix=read.csv("Trial.csv",header=T) # The 1st table that you have considered * *Test_matrix=as.matrix(Test_matrix)* *Writer=function(mat){u=unique(mat[,"Subject"])* *l=length(u)* *dummy=lapply(1:l,FUN

Re: [R] scraping with session cookies

2012-09-23 Thread Heramb Gadgil
timing out, the odd part > is that I can access to the link through a browser with no issues at all!! > Any ideas why it keeps timing out? Also how can I keep the loop running > after this error? > > Thanks again for your help! > > > On Wed, Sep 19, 2012 at 11:36 P

Re: [R] VarBrul in R

2012-09-21 Thread Heramb Gadgil
I do not know about the packages that you mentioned. I am trying to answer your query based on the term "socio-linguistic analytics". There are packages like "OpenNLP","OpenNLP.en","tm (Text Mining)" that might be of your interest. Best, Heramb On Fri, Sep 21, 2012 at 1:04 AM, Trevor Jenkins wro

Re: [R] SQL query with Multicore option on R -linux

2012-09-21 Thread Heramb Gadgil
This is what I think; Hive internally distributes the data. If you have set up Hive on single core it will fetch the query results from that core. If you have multi-core system on which you have setup the Hive, it will search all the cores for the query submitted and results would be compiled toge

Re: [R] (no subject)

2012-09-21 Thread Heramb Gadgil
Hi, Another way of doing may be like this; a <- c("d", "d", "j", "f", "e", "g", "f", "f", "i", "g") b <- c("a", "g", "d", "f", "g", "a", "f", "a", "b", "g") ta <- table(a) tb <- table(b) Function<-function(Tab1,Tab2){elements=sort(unique(c(names(ta),names(tb OP=lapply(1:length(elements),FUN

Re: [R] issue accessing help files

2012-09-19 Thread Heramb Gadgil
Try this; help(anova) I have used this in R-2.14.1 It has worked fine for me. Hope it works for you as well. Best, Heramb On Thu, Sep 20, 2012 at 1:40 AM, Rui Barradas wrote: > Hello, > > I had a problem seeing the help pages with R 2.14.(0 or 1? I don't > remember) on Windows 7. > Then I re

Re: [R] scraping with session cookies

2012-09-19 Thread Heramb Gadgil
Try this, library(RCurl) library(XML) site<-" http://www.wateroffice.ec.gc.ca/graph/graph_e.html?mode=text&stn=05ND012&prm1=3&syr=2012&smo=09&sday=15&eyr=2012&emo=09&eday=18 " URL<-getURL(site) Text=htmlParse(URL,asText=T) This will give you all the web dat in an HTML-Text format. You can use

Re: [R] Importing a CSV file

2012-09-19 Thread Heramb Gadgil
Hi All, I have used windows R. We can also write like this: A <- read.csv("C:/Users/Anthi/Desktop/R/A.csv",header=TRUE) On Wed, Sep 19, 2012 at 8:09 PM, Marc Schwartz wrote: > > On Sep 19, 2012, at 9:26 AM, Rui Barradas wrote: > > > > > Em 19-09-2012 15:01, Sarah Goslee escreveu: > >> On W

Re: [R] I want to send the vector a into the Object A.......

2012-09-17 Thread Heramb Gadgil
A<- get("a") This will work fine Best, Heramb On Mon, Sep 17, 2012 at 5:43 PM, Sri krishna Devarayalu Balanagu < balanagudevaray...@gvkbio.com> wrote: > a=c(1,2,3) > b=c(23, 24, 25) > x=c("a", "b") > #if (length(x[1]) == 0) {cat("x[1] is having 3 elements")} > > Suppose I want to send the vect

Re: [R] eval(parse(...)) only once in a function

2012-09-17 Thread Heramb Gadgil
If you have a data frame "df" with a column "JT" Try this one: str <- "df$JT == 12" fun<-function(str){b<-eval(parse(text=str)) return(b)} fun(str) On Mon, Sep 17, 2012 at 11:57 AM, Christof Kluß wrote: > Hi > > I would like to have something like > > str <- "df$JT == 12" > > fun <- function(d