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] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Heramb
,])))} Tab=cbind(Tab,x) } Table<<-Tab } Matrix(n,simulations) #Matrix(5,100) colnames(Table)=NULL Best, Heramb -Original Message- From: Heramb [mailto:hera

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Heramb
this works Best, Heramb M. Gadgil -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bärbel Sent: Wednesday, November 07, 2012 6:32 PM To: r-help@r-project.org Subject: [R] how to generate a set of random numbers that sum to 1 with uniform

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
t;-paste('Site',1:3)* *Final_Table<<-Final* *}* *User_Defined(Data1,Data2)* *Final_Table* I hope this is what you need. Best, Heramb On Tue, Sep 25, 2012 at 1:41 PM, Benjamin Gillespie wrote: > Hi, > > Thanks for helping me with this one. > > To save you time, the

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

2012-09-25 Thread Heramb Gadgil
x[i,j]=count}}* * write.csv(dummy_matrix,paste('/home/hduser/',file_name,'_counts','.csv',sep='')) * *write.csv(m,paste('/home/hduser/',file_name,".csv",sep=""))* *})}* *I hope this helps,* *Best,* *Heramb * On Tue, Sep 25, 2012 a

Re: [R] scraping with session cookies

2012-09-23 Thread Heramb Gadgil
ight help you. Best, Heramb On Fri, Sep 21, 2012 at 8:45 PM, CPV wrote: > Thanks for your suggestion, > The issue was resolved by Duncan's recommendation. > > Now I am trying to obtain data from different pages from the same site > through a loop, however, the getURLContent keeps

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,

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

2012-09-21 Thread Heramb Gadgil
together for final output. The query would remain the same no matter whther you have a single core or multiple cores or a cluster of machines. Please correct me if I am going the wrong way. Best, Heramb On Thu, Sep 20, 2012 at 11:34 PM, Madana_Babu wrote: > Hi all, > > I have the foll

Re: [R] (no subject)

2012-09-21 Thread Heramb Gadgil
ot;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=function(x){a=which(elements[x]==names(Tab1)) b=which(elements[x]==names(Tab2))

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 Wi

Re: [R] scraping with session cookies

2012-09-19 Thread Heramb Gadgil
all the web dat in an HTML-Text format. You can use "getNodeSet" function to extract whatever links or texts that you want from that page. I hope this helps. Best, Heramb On Wed, Sep 19, 2012 at 10:26 PM, CPV wrote: > Thanks again, > > I run the script with the postForm(site,

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

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