Re: [R] Loop question?

2013-01-26 Thread David Hugh-Jones
Here's a toy example which you can apply the logic of: dfr - expand.grid(1:3,1:2) results - apply(dfr, 1, sum) dfr[results==4,] On 25 January 2013 22:19, Andras Farkas motyoc...@yahoo.com wrote: Dear All I have the following data (somewhat simplyfied): TINF -1 a

Re: [R] importing data

2013-01-26 Thread Ray Cheung
Thanks for your commands, Ivan and Michael! However, I am still not producing the right codes. Would you please help me on this? I've written the following codes. Please comment. Thank you very much. Task: Reading data1.dat to data1000.dat (with missing files) into R. Missing files can be omitted

Re: [R] importing data

2013-01-26 Thread David Hugh-Jones
Hi Ray, Comments below: On 26 January 2013 09:03, Ray Cheung ray1...@gmail.com wrote: [snip] ###FUNCTION TO READ FILES little_helpful - function(n) { file_name - paste0(C:/.../data, n, .dat) read.table(file_name) } ###RETURN AN OBJECT WHICH CHECKS FOR THE EXISTENCE OF FILES check -

Re: [R] read.csv quotes within fields

2013-01-26 Thread John Kane
Following David's suggestion you might want to have a look at https://confluence.clazzes.org/display/CSVEDIT/CSVEdit+Home . I have not used it but it seems to get good reviews from people I know. John Kane Kingston ON Canada -Original Message- From: dwinsem...@comcast.net Sent:

Re: [R] joint probability distribution

2013-01-26 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example John Kane Kingston ON Canada -Original Message- From: eliza_bo...@hotmail.com Sent: Fri, 25 Jan 2013 18:13:55 + To: r-help@r-project.org Subject: [R] joint probability distribution Dear

Re: [R] Pass vector as multiple parameters (as in python f(*x))

2013-01-26 Thread Suzen, Mehmet
This an alternating way of doing it using a list if you know the argument names in the function definition i.e. ?formals and ?alist, But would change the default values of the function. Probably not you wanted. f - function(x,y,z) x+y+z args-alist(x=5,y=6,z=7) formals(f) - args f() [1] 18

Re: [R] Loop question?

2013-01-26 Thread Andras Farkas
Sorry Jeff, probably the new version of Yahoo mail doing the html, I switched back to the older one hope that takes care of the problem. Let me clarify the code below: TINF -1 a -c(500,750,1000,1250,1500,1750,2000) b -c(8,12,18,24,36,48,60,72,96) infcprodessa -function (D, tin, tau, ts)

[R] google APi or java popup or slide window information

2013-01-26 Thread Janue Miret, Jofre
How can I do with R an APi or java popup or slide window information ? I would like to generate a html or php files raster map colors, with a numerical values, and with information popup window over each data. Do you know any Java or gogle APi examples?

[R] Setting global variables inside R reference class ?

2013-01-26 Thread Praveen K
Hello, I'm a newbie to R, I have a quesiton. I'm a bit confused on global variable assignments. I have the following situation. I have 2 global variables current_idx and previous_idx. *These 2 global variables have to be set by a method in a reference class*. Essentially, using - assignment

Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-26 Thread Benjamin Ward (ENV)
Hi, I've been trying to work this out how it works, I'm still not totally sure but seems to me it subsets the matrix according to whether each column returns all TRUE, to not being the same values when you compare the column[-1] and the column[-length(column)], essentially siding the column

[R] Attempting to confirm a program i wrote in C (normalize 2 datasets, transform into histogram, transform into CDF, perform KS test)

2013-01-26 Thread Tarskin
I have written a program in C that two xy datasets, aligns these 2 datasets based on shared features, transforms them into equal sized histograms, transforms the histograms into cumulative distribution functions (via GSL) and finally performs a KS_test. I am wanting to validate my program's

Re: [R] read.csv quotes within fields

2013-01-26 Thread Tim Howard
Duncan, Good point - I guess I am expecting too much. I'll work on a global replace before import or chopping with strsplit while importing. FYI everyone - these folks with the non-standard csv are the US Feds:

Re: [R] Setting global variables inside R reference class ?

2013-01-26 Thread Jeff Newmiller
How can we possibly know where you went wrong if you don't tell us where you went? http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --- Jeff NewmillerThe

Re: [R] Attempting to confirm a program i wrote in C (normalize 2 datasets, transform into histogram, transform into CDF, perform KS test)

2013-01-26 Thread Jeff Newmiller
It is generally expected that the questioner pose a specific example so the respondent can have some assurance they are answering the actual question. In this case please provide a test data set, intermediate results, and final result generated by your C program. It would also show that you

Re: [R] Loop question?

2013-01-26 Thread Berend Hasselman
On 26-01-2013, at 12:31, Andras Farkas motyoc...@yahoo.com wrote: Sorry Jeff, probably the new version of Yahoo mail doing the html, I switched back to the older one hope that takes care of the problem. Let me clarify the code below: TINF -1 a -c(500,750,1000,1250,1500,1750,2000) b

Re: [R] Removal of columns from matrix where all values of the column are identical.

2013-01-26 Thread arun
HI Ben, Sorry, I didn't test it at that time to different cases. testm[,apply(testm,2,function(x) all(c(TRUE,x[-length(x)]!=x[-1])))] x[-length(x)] #removes the last observation in each column x[-1] #removes the first observation in each column #and compares them for each column. If I change the

Re: [R] read.csv quotes within fields

2013-01-26 Thread peter dalgaard
On Jan 26, 2013, at 16:32 , Tim Howard wrote: Duncan, Good point - I guess I am expecting too much. I'll work on a global replace before import or chopping with strsplit while importing. FYI everyone - these folks with the non-standard csv are the US Feds:

Re: [R] cannot allocate memory block of size 2.7 Gb

2013-01-26 Thread Uwe Ligges
On 23.01.2013 23:41, Cláudio Brisolara wrote: Hello R-users I am getting error messagens when I require some packages or execute some procedures, like these below: require(tseries) Loading required package: tseries Error in get(Info[i, 1], envir = env) : cannot allocate memory

[R] different legends in lattice panels

2013-01-26 Thread Tito de Morais Luis
Hi listers, I want to make lattice plots xyplots with the indication of legends inside each panel with only the points and the lines actually ploted inside each given panel according to the group(ing) factor. The code below shows what I have achieved so far and I hope will make clear what I

Re: [R] Loop question?

2013-01-26 Thread Jeff Newmiller
The unlist-sapply-seq_len bit is unnecessarily convoluted, since the infcprodessa function can accept vector inputs. z - infcprodessa( ab$a, TINF, ab$b, ab$b-TINF ) possibles - ab[ z = 15 z = 20, ] possibles[ which.min( possibles$a ), ]

Re: [R] Error with Expected Shortfall function, ES.

2013-01-26 Thread Uwe Ligges
On 24.01.2013 13:33, kevj1980 wrote: ES function gives the below error. ES(sim, p=.95, method=c(modified),portfolio_method=c(component), weights=w1) We get: Error: object 'ES' not found Uwe Ligges /Error in checkData(R, method = xts, ...) : The data cannot be converted into a time

Re: [R] stepwise variable selection method wanted

2013-01-26 Thread Uwe Ligges
On 19.01.2013 01:57, Julien Mehl Vettori wrote: Dear Herry, This is the R-help mailing list with thousands of readers. Your message is without any context. Do you really expect an answer? Best, Uwe Ligges I would like to know if you found an answer elsewhere to your question. I'm

[R] a function more appropriate than 'sapply'?

2013-01-26 Thread emorway
I'm wondering if I need to use a function other than sapply as the following line of code runs indefinitely (or 30 min so far) and uses up all 16Gb of memory on my machine for what seems like a very small dataset (data attached in a txt file wells.txt

Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Berend Hasselman
On 26-01-2013, at 19:43, emorway emor...@usgs.gov wrote: I'm wondering if I need to use a function other than sapply as the following line of code runs indefinitely (or 30 min so far) and uses up all 16Gb of memory on my machine for what seems like a very small dataset (data attached in a

[R] Loading data into R

2013-01-26 Thread Christofer Bogaso
Hello again, I generally use Clipboard to load data into R from Excel using the read.delim() function. In most cases, my data after loading looks like below: myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(, 2, a), class = factor), V2 = structure(c(4L, 3L, 1L, 2L, 1L),

Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Uwe Ligges
On 26.01.2013 20:46, Berend Hasselman wrote: On 26-01-2013, at 19:43, emorway emor...@usgs.gov wrote: I'm wondering if I need to use a function other than sapply as the following line of code runs indefinitely (or 30 min so far) and uses up all 16Gb of memory on my machine for what seems

Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Berend Hasselman
On 26-01-2013, at 21:09, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 26.01.2013 20:46, Berend Hasselman wrote: On 26-01-2013, at 19:43, emorway emor...@usgs.gov wrote: I'm wondering if I need to use a function other than sapply as the following line of code runs indefinitely

Re: [R] Loading data into R

2013-01-26 Thread Duncan Murdoch
On 13-01-26 3:00 PM, Christofer Bogaso wrote: Hello again, I generally use Clipboard to load data into R from Excel using the read.delim() function. In most cases, my data after loading looks like below: myData - structure(list(V1 = structure(c(3L, 2L, 1L, 1L, 2L), .Label = c(, 2, a), class =

Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread Uwe Ligges
On 26.01.2013 21:23, Berend Hasselman wrote: On 26-01-2013, at 21:09, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 26.01.2013 20:46, Berend Hasselman wrote: On 26-01-2013, at 19:43, emorway emor...@usgs.gov wrote: I'm wondering if I need to use a function other than sapply as

[R] Text mining

2013-01-26 Thread Steve Stephenson
Hallo to everybody, I would like to perform an analysis but I don't know how to proceed and whether R packages are available for my purpose or not. Therefore I'm here to request your support. *The idea is the following:* I noticed that the names of the towns and villages in northern Italy most of

Re: [R] Text mining

2013-01-26 Thread Giovanni Azua
Hi Steve, IMO this problem does not need a classifier but rather a database and a simple query. I would just build a database with all city names including the geo information, and then say whether it is north or south exactly. If there was such a rule (which I doubt) I would expect it to have

Re: [R] Loading data into R

2013-01-26 Thread arun
Hi, myData[]-lapply(myData,as.character)  as.matrix(myData) # V1  V2   V3  V4  V5 #[1,] a b  c d f #[2,] 2 4      7 #[3,]          #[4,]   34   4 #[5,] 2    4   4 str(as.matrix(myData)) # chr [1:5, 1:5] a 2 2 b 4 34 ...  #- attr(*, dimnames)=List of 2   #..$ : NULL   #..$ : chr

Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread arun
Hi, May be this helps:  wells-read.table(wells.txt,header=FALSE,stringsAsFactors=F)  wells2-wells[-grep(.*\\_.*\\_,wells[,1]),]   head(wells2)   #   V1 V2 #1  w7_1  0 #2 w11_1  0 #3 w12_1  0 #4 w13_1  0 #5 w14_1  0 #6 w15_1  0 wellsNew-wells[grep(.*\\_.*\\_,wells[,1]),]  head(wellsNew) #  

Re: [R] a function more appropriate than 'sapply'?

2013-01-26 Thread arun
HI, ?grep() found to be a bit faster. system.time({ indx-grep(.*\\_.*\\_,wells[,1]) wells2-wells[-indx,] wellsNew-wells[indx,]}) # user  system elapsed  # 0.024   0.000   0.023  system.time({  w.sub - gsub([^_]+,,wells[,1])   u.2 - which(w.sub==__)   u.1 - which(w.sub==_)  w.u1- wells[u.1,]

Re: [R] Text mining

2013-01-26 Thread Steve Stephenson
Hi Giovanni, thanks a lot for your quick reply!!! I try to answer you in a few points: 1 - A Data Base containing all the towns and the Region they belong to (North, Sud...) is already available on the ISTAT site (www.ISTAT.it); 2- My goal was just to find a method supporting my idea, that is to

Re: [R] confidence / prediction ellipse

2013-01-26 Thread Bert Gunter
Well, I'd guess you have to first define what you mean by prediction ellipse, as the confidence ellipses are for the bivariate distribution of 2 parameter estimates -- as I understand it -- whereas predictions depend on the covariate values and are for a single response value (unless you have

Re: [R] Converting column of strings to boolean

2013-01-26 Thread Pete Brecknock
domcastro wrote Hi I'm trying to convert a column of strings (nominal types) to a set of boolean / binary / logical values. For example, in the column there is red, blue, green and yellow. There are 100 rows and each has a colour. I want to convert the column to 4 columns: red, blue,

Re: [R] different legends in lattice panels

2013-01-26 Thread ilai
On Sat, Jan 26, 2013 at 10:26 AM, Tito de Morais Luis luis.tito-de-mor...@ird.fr wrote: Hi listers, I want to make lattice plots xyplots with the indication of legends inside each panel with only the points and the lines actually ploted inside each given panel according to the group(ing)

[R] How to remove packages from the active working window

2013-01-26 Thread hp wan
Hi all mailing listers, My question is as follows: e.g. I launched two packages, say packageA and packageB, but they have the function of the same name, leading to masking. I want to remove the packageA from the working window after using the packageA so as not to causing problem. I do not want

[R] decimal places in R2HTML

2013-01-26 Thread Erin Hodgess
Dear R People: I have an AOV model that I get confidence intervals from via confint(chick1.aov1) 2.5 % 97.5 % trtA 1.472085 1.607915 trtB 1.512085 1.647915 trtC 1.328751 1.464582 I am using R2HTML to produce HTML output. However, the HTML code itself just has rounded values, i.e.,

Re: [R] decimal places in R2HTML

2013-01-26 Thread Joshua Wiley
Realized I did not reply to this list. On Sat, Jan 26, 2013 at 7:54 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Erin, Most packages creating output for inclusion in pages, reports, books, etc. do some rounding as R's default level of printed precision tends to be overkill. R2HTML is

Re: [R] How to remove packages from the active working window

2013-01-26 Thread David Winsemius
On Jan 26, 2013, at 6:26 PM, hp wan wrote: Hi all mailing listers, My question is as follows: e.g. I launched two packages, say packageA and packageB, but they have the function of the same name, leading to masking. I want to remove the packageA from the working window after using the

Re: [R] How to remove packages from the active working window

2013-01-26 Thread hp wan
Thanks a lot! 2013/1/27 David Winsemius dwinsem...@comcast.net On Jan 26, 2013, at 6:26 PM, hp wan wrote: Hi all mailing listers, My question is as follows: e.g. I launched two packages, say packageA and packageB, but they have the function of the same name, leading to masking. I want