Re: [R] speed issue: gsub on large data frame

2013-11-05 Thread Jeff Newmiller
It is not reproducible [1] because I cannot run your (representative) example. The type of regex pattern, token, and even the character of the data you are searching can affect possible optimizations. Note that a non-memory-resident tool such as sed or perl may be an appropriate tool for a

Re: [R] speed issue: gsub on large data frame

2013-11-05 Thread Simon Pickert
How’s that not reproducible? 1. Data frame, one column with text strings 2. Size of data frame= 4million observations 3. A bunch of gsubs in a row ( gsub(patternvector, “[token]“,dataframe$text_column) ) 4. General question: How to speed up string operations on ‘large' data sets? Please let

Re: [R] speed issue: gsub on large data frame

2013-11-05 Thread Jim Holtman
what is missing is any idea of what the 'patterns' are that you are searching for. Regular expressions are very sensitive to how you specify the pattern. you indicated that you have up to 500 elements in the pattern, so what does it look like? alternation and backtracking can be very

[R] Reading only one Column of an excel file using RODBC

2013-11-05 Thread Baro
Hi experts How can I read only one column of an excel file using RODBC in r? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Reading only one Column of an excel file using RODBC

2013-11-05 Thread Prof Brian Ripley
On 05/11/2013 09:18, Baro wrote: Hi experts How can I read only one column of an excel file using RODBC in r? The same way as for any other ODBC client: by selecting it in SQL. [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] speed issue: gsub on large data frame

2013-11-05 Thread Prof Brian Ripley
But note too what the help says: Performance considerations: If you are doing a lot of regular expression matching, including on very long strings, you will want to consider the options used. Generally PCRE will be faster than the default regular expression engine, and

Re: [R] All curves with same y-axis scale

2013-11-05 Thread mohan . radhakrishnan
Hi Jim, I am using this code and it is working well. I convert everything to MB. I may not fully understand levels(data$Used)[data$Used]) but I use it everywhere and it works. data$Used - as.numeric(levels(data$Used)[data$Used])/(1024*1000) data$Committed -

Re: [R] Reading only one Column of an excel file using RODBC

2013-11-05 Thread Baro
Yes, but I dont know how can I SELECT the infos from one column. Columns have no names in my excel. I tried it jo-odbcConnectExcel2007(D:\\MA\\excel_mix_meiningen.xls) dfr - sqlQuery(jo,SELECT top 1 F1 FROM `Tabelle1$`) close(jo) dfr but I get an error: [1] 07002 -3010 [Microsoft][ODBC Excel

[R] Function does not see variables outside the function

2013-11-05 Thread Zhong-Yuan Zhang
Dear experts: In MATLAB, functions cannot see variables outside the functions. However, in R, the functions can do that. Is there any settings that can disable this ability of functions? Many thanks for your kind help. Best Regards Always. [[alternative HTML version

[R] fail to install packages in R3.0.2 running in Redhat linux

2013-11-05 Thread Mao Jianfeng
Dear R-helpers, Glad to write to you. I would like to have your helps to install packages through internet, in a linux computer. Could you please share any of your expertise with me on this problem? Thanks in advance. Best Jian-Feng, # check the

[R] regession code

2013-11-05 Thread IZHAK shabsogh
y - c(5.5199668,  1.5234525,  3.3557000,  6.7211704,  7.4237955,  1.9703127, +    4.3939336, -1.4380091,  3.2650180,  3.5760906,  0.2947972,  1.0569417) x - c(1,   0,   0,   4,   3,   5,  12,  10,  12, 100, 100, 100) fn-function(x,y){ + lreg-lm(y ~ x) + } fn(x,y) b-coef(fn) Error:

Re: [R] speed issue: gsub on large data frame

2013-11-05 Thread Simon Pickert
Thanks everybody! Now I understand the need for more details: the patterns for the gsubs are of different kinds.First, I have character strings, I need to replace. Therefore, I have around 5000 stock ticker symbols (e.g. c(‚AAPL’, ‚EBAY’,…) distributed across 10 vectors. Second, I have four

Re: [R] regession code

2013-11-05 Thread Rui Barradas
Hello, You are trying to get the coefficients of the function, nt of that function's result. Also, your function returns nothing. Try instead fn - function(x,y){ lreg - lm(y ~ x) lreg } fit - fn(x,y) b - coef(fit) b Hope this helps, Rui Barradas Em 05-11-2013 10:56, IZHAK

Re: [R] Function does not see variables outside the function

2013-11-05 Thread Rui Barradas
Hello, I believe the answer is no. Functions will first look in their environment, and then in the parent frame, i.e., outside the function. Hope this helps, Rui Barradas Em 05-11-2013 10:42, Zhong-Yuan Zhang escreveu: Dear experts: In MATLAB, functions cannot see variables outside

Re: [R] fail to install packages in R3.0.2 running in Redhat linux

2013-11-05 Thread Marc Schwartz
On Nov 5, 2013, at 4:38 AM, Mao Jianfeng jianfeng@gmail.com wrote: Dear R-helpers, Glad to write to you. I would like to have your helps to install packages through internet, in a linux computer. Could you please share any of your expertise with me on this problem? Thanks in

Re: [R] Function does not see variables outside the function

2013-11-05 Thread Prof Brian Ripley
On 05/11/2013 12:25, Rui Barradas wrote: Hello, I believe the answer is no. Functions will first look in their environment, and then in the parent frame, i.e., outside the function. That is not correct. The scoping rule when evaluatiing a function is to look first in the evaluation frame,

Re: [R] speed issue: gsub on large data frame

2013-11-05 Thread Carl Witthoft
My feeling is that the **result** you want is far more easily achievable via a substitution table or a hash table. Someone better versed in those areas may want to chime in. I'm thinking more or less of splitting your character strings into vectors (separate elements at whitespace) and chunking

Re: [R] Error message in SPACECAP package

2013-11-05 Thread PIKAL Petr
Hi Although I do not know about SPACECAP here are few hints. Usually attachment does not go through, use dput instead. Copy output of dput(head(yourdata)) to the mail. str(yourdata) Gives you (and us if you show the output) some info about your data mode. My opinion is that some column is

Re: [R] forecast.lm() and NEWDATA

2013-11-05 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Ryan Sent: Monday, November 04, 2013 4:19 PM To: David Winsemius Cc: r-help@r-project.org Subject: Re: [R] forecast.lm() and NEWDATA Hi David (and everyone) Thank you

Re: [R] Function does not see variables outside the function

2013-11-05 Thread Carl Witthoft
Why would you want to impose this restriction? Perhaps if you explain what you are trying to do, we can suggest approaches that will satisfy your specific needs. (note- one can always redefine whatever variables are to be excluded. E.g. to keep the body of a function from referring to 'foo' in

Re: [R] fail to install packages in R3.0.2 running in Redhat linux

2013-11-05 Thread Marc Schwartz
Can you use those programs to get to the package tar file directly: http://ftp.ctex.org/mirrors/CRAN/src/contrib/ggplot2_0.9.3.1.tar.gz If so, you might want to download it and then install as a local package installation on the remote server from the CLI (eg. using R CMD INSTALL ...). You

Re: [R] fail to install packages in R3.0.2 running in Redhat linux

2013-11-05 Thread Mao Jianfeng
Hi Marc, Thanks a lot for your reply. In fact, I am running R in a remote linux server. I am wondering there are some special settings for Internet access in this server. I have ever tried to use different CRAN mirrors, and failed. I can use lftp, wget, curl to link to internet, in this server.

Re: [R] Path Analysis

2013-11-05 Thread Sarah Rogers
Dear John, Thanks for your help. I run the path analysis but the model does not fit the data. I am in doubt if this reflects the model construction et al. (too many variables or more needed, more paths or change in direction of paths, sample size, etc) or it could be that there is an

Re: [R] How to obtain nonparametric baseline hazard estimates in the gamma frailty model?

2013-11-05 Thread Terry Therneau
I have responded to this particular misconception so often I begin to grow grumpy about it (not the particular fault of YH). The cumulative hazard function from fit - coxph( some model) sfit - survfit(fit, newdata= set of covariate values) gives the survival curve and

[R] Problem while reading Data from a data frame

2013-11-05 Thread Baro
Hi experts, I want to read only the half of my data frame, which I read it from clip board, and save it in a list. I wrote this code but it doesnt work: ck-read.table(clipboard) datalist-list() d-dim(ck)[1] i-1 repeat { datalist-c(datalist,ck[i,]) i-i+2 if(id) {break} } datalist

[R] Sample size for clustering analysis?

2013-11-05 Thread Li, Yan
Hi All, What formula can I use to determine the right sample size for clustering analysis with 100-300 variables? What sampling methodology can be used for k-means or hierarchical clustering on categorical fields so that all values of the categorical fields are included in the sample? Thanks

[R] Regression of the sum of distributions on an histogram with R

2013-11-05 Thread Xavier Prudent
Dear all, I hope that is the right list for my question Here is the case: I want to describe an histogram as the sum of several distributions, and thus to fit these distributions on that histogram. In ROOT/C++ that is pretty obvious, but I look for the equivalent in R. Here is a

[R] Nadaraya-Watson kernel

2013-11-05 Thread Ms khulood aljehani
Hello i want to compute the Nadaraya-Watson kernel estimation when the kernel function is Epanchincov kernel i use the command ksmooth(x, y, kernel=normal, bandwidth ,) the argmunt ( kernel=normal ) accept normal and box kernels i want to compute it if the kerenl = Epanchincov thank

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread ONKELINX, Thierry
You don't need a loop nor a growing object. data(mtcars) mtcars mtcars[seq(1, nrow(mtcars), by = 2), ] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread PIKAL Petr
Hi You shall probably use C or similar program for such task. As I understand you want only odd rows. If yes, this will do it for you odd-seq(1,d,2) datalist-cd[odd,] If not please explain better your real intention. Regards Petr -Original Message- From:

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread PIKAL Petr
Sorry shall be datalist-ck[odd,] Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of PIKAL Petr Sent: Tuesday, November 05, 2013 3:56 PM To: Baro; R help Subject: Re: [R] Problem while reading Data from a data

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread Baro
thank you for your answers. It works and I have such an output: [1] 491 492 494 492 493 492 494 493 493 492 491 491 493 494 492 493 494 492 493 492 491 494 492 491 493 495 [27] 492 492 491 493 492 493 495 493 492 491 494 493 492 491 491 494 492 493 492 492 492 492 494 492 491 493 [53] 493 493 494

Re: [R] How to plot results of clmm()?

2013-11-05 Thread Michael Friendly
On 11/4/2013 9:13 AM, thomas wrote: Dear list, I'd like to create a visual plot of a clmm() I've fitted using the 'ordinal' package in R. It's possible to do this with a glm() by using the 'effects' package. For example: library(effects) data(BEPS) mod - lm(political.knowledge ~

[R] writing blobs with RDBI

2013-11-05 Thread Witold E Wolski
How to write a blob with RDBI? assuming I have x - 1:10 * 0.1 How do I store it in a sql table as an blob? regards -- Witold Eryk Wolski __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] FW: Nadaraya-Watson kernel

2013-11-05 Thread Ms khulood aljehani
From: aljehan...@hotmail.com To: r-help@r-project.org Subject: Nadaraya-Watson kernel Date: Tue, 5 Nov 2013 17:42:13 +0300 Hello i want to compute the Nadaraya-Watson kernel estimation when the kernel function is Epanchincov kernel i use the command ksmooth(x, y, kernel=normal, bandwidth

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread PIKAL Petr
Hi It means that what you read is a factor. Most probably the values are formated in scientific notation which is not read properly as numbers. You shall format numbers in your Excel file so that it does not have comma but dot. Or you can transfer those values to numbers in R. see ?factor

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread Baro
I exactly jump over this values and only have the integer values, henc I want to read only odd rows On Tue, Nov 5, 2013 at 7:31 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi It means that what you read is a factor. Most probably the values are formated in scientific notation which is

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread Bert Gunter
Please follow Petr's advice and read the Introduction to R or other R online tutorial (there are many) before posting further basic questions here. You need to make an effort to learn the basics of R before pestering this list with questions such as these. Cheers, Bert On Tue, Nov 5, 2013 at

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread PIKAL Petr
Read ?as.numeric ?as.character Anyway. There is really extensive documentation coming with R. By using it you can save your time quite considerably. Here is snippet from FAQ 7.10 How do I convert factors to numeric? It may happen that when reading numeric data into R (usually, when reading in

Re: [R] Problem while reading Data from a data frame

2013-11-05 Thread Baro
thanks :) On Tue, Nov 5, 2013 at 7:45 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Read ?as.numeric ?as.character Anyway. There is really extensive documentation coming with R. By using it you can save your time quite considerably. Here is snippet from FAQ *7.10 How do I

Re: [R] How to plot results of clmm()?

2013-11-05 Thread John Fox
Dear Thomas and Michael, As Michael knows, there is a default Effect() method in the development version of the effects package on R-Forge. This should work with almost all model objects that produce a single fitted value and that respond to coef(), model.frame(), formula(), and vcov(). This

[R] Convert date column with two different structures

2013-11-05 Thread Abraham Mathew
Let's say I have the following data frame and the date column has two different ways in which date is presented. How can I use as.Date or the lubridate package to have one date structure for the entire colum df = data.frame(Date=c(5/1/13,8/1/13,9/1/13,Apr-10, Apr-11,Apr-12,Apr-13))

[R] multi

2013-11-05 Thread IZHAK shabsogh
[[1]] [,1]  [,2] [1,]  0.003632559 0.2190629 [2,] -2.090772847 0.2190629 [[2]]     [,1]   [,2] [1,] 0.004278991 0.04337005 [2,] 0.190723602 0.04337005 [[3]]    [,1]    [,2] [1,] 0.01237827 -0.01544811 [2,] 0.06452200 -0.01544811 g-c(1,2,3)

Re: [R] Convert date column with two different structures

2013-11-05 Thread Rui Barradas
Hello, Try the following. idx - grep([[:alpha:]], df$Date) Date - as.Date(df$Date, %m/%d/%y) Date[idx] - as.Date(paste(01, df$Date[idx]), %d %b-%y) Hope this helps, Rui Barradas Em 05-11-2013 16:00, Abraham Mathew escreveu: Let's say I have the following data frame and the date column

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-05 Thread Barry Rowlingson
On 4 Nov 2013 19:30, David Winsemius dwinsem...@comcast.net wrote: Maybe you should use their download facility rather than trying to deparse a complex webpage with lots of special user interaction features: http://appsso.eurostat.ec.europa.eu/nui/setupDownloads.do That web page depends on

Re: [R] Path Analysis

2013-11-05 Thread John Fox
Dear Sarah, As you know, our discussion continued off-list, and I'm glad that you were able to get the software to work. I'll address your question briefly, but what I have to say probably isn't what you want to hear: Most fundamentally, the information you've provided is entirely without

Re: [R] multi

2013-11-05 Thread arun
Hi, May be this helps: set.seed(42)  list1 - lapply(1:3, function(i) matrix(rnorm(4),2,2)) g - c(1,2,3) fun1 - function(g,hessianList){   mat1 - vector(mode=list,length=length(g))    for(i in seq_along(g)){ mat1[[i]] - g[i]*hessianList[[i]]       } Reduce(`+`,mat1)   }

Re: [R] Convert date column with two different structures

2013-11-05 Thread arun
HI, You could try: library(lubridate) Date1 - mdy(as.character(df[,1]))  Date1[is.na(Date1)] - parse_date_time(paste(1,as.character(df[,1][is.na(Date1)]),sep=-),%d-%b-%y) A.K. On Tuesday, November 5, 2013 12:38 PM, Abraham Mathew abmathe...@gmail.com wrote: Let's say I have the following

Re: [R] multi

2013-11-05 Thread Adams, Jean
It's easier for folks to help you if you make your data available by reproducible code. You can do this using the dput() function. So, for example, you could share your hessianList with us using dput(hessianList) and then including this code in your post hessianList -

Re: [R] Sampling question

2013-11-05 Thread arun
Hi, You may try: dat1 - structure(list(SubID = 1:8, CSE1 = c(6L, 6L, 5L, 5L, 5L, 5L, 3L, 3L), CSE2 = c(5L, 4L, 5L, 4L, 6L, 4L, 6L, 6L), CSE3 = c(6L, 7L, 5L, 3L, 7L, 3L, 6L, 6L), CSE4 = c(2L, 2L, 5L, 4L, 5L, 6L, 3L, 3L), WSE1 = c(6L, 6L, 5L, 4L, 6L, 4L, 6L, 6L), WSE2 = c(2L, 6L, 5L, 4L, 4L,

[R] How can I use muliple cores of CPU in Windows or OS X?

2013-11-05 Thread Agony
Dear all, I have about 50 pages of R codes and ran it in both OS X and Windows. It takes at least haft a day to have the results. The running time is not very different in both Systems. I found that R does not use all cores of CPU by default. Can anybody help me to use all cores of CPU in my

Re: [R] How can I use muliple cores of CPU in Windows or OS X?

2013-11-05 Thread Simon Pickert
Mcapply from package 'parallel'. Also see package 'multicore' Am 06.11.2013 um 00:01 schrieb Agony agony_...@yahoo.com: Dear all, I have about 50 pages of R codes and ran it in both OS X and Windows. It takes at least haft a day to have the results. The running time is not very

Re: [R] Download CSV Files from EUROSTAT Website

2013-11-05 Thread Paul Bivand
This looks as though you need to be a little XML old-school. readHTMLTable is a summary function drawing on: ?htmlTreeParse() turns the table into xml ?xpathApply() and more. #xpathApply(doc, , //td, function(x)xmlValue(x)) breaks each line at the end of a table cell and extracts the value #

Re: [R] How can I use muliple cores of CPU in Windows or OS X?

2013-11-05 Thread Uwe Ligges
On 06.11.2013 00:26, Simon Pickert wrote: Mcapply from package 'parallel'. Also see package 'multicore' Not mcapply: it won't work under Windows that the OP asked for. But package parallel is the right hint. It also provides other parallelization techniques that will work under Windows.

Re: [R] How can I use muliple cores of CPU in Windows or OS X?

2013-11-05 Thread Peter Langfelder
On Tue, Nov 5, 2013 at 3:36 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 06.11.2013 00:26, Simon Pickert wrote: Mcapply from package 'parallel'. Also see package 'multicore' Not mcapply: it won't work under Windows that the OP asked for. But package parallel is the right

[R] Help on error (Error: could not find function kernelUD)

2013-11-05 Thread Angela Dwyer
Hello, I am working through examples of generating Home Range using the adehabitatHR package. Everything is going fine until I load the code for the kernelUD function, it looks like this; data(puechabonsp) kud - kernelUD(puechabonsp$relocs[,1], h=href) kud I then get an error of; Error:

[R] Error message glmer using R: “ 'what' must be a character string or a function”

2013-11-05 Thread EmmaB
I am running a multi-level model. I use the following commands with validatedRS6 as the outcome, random as the predictor and clustno as the random effects variable. new-as.data.frame(read.delim(BABEX.dat, header=TRUE)) install.packages(lme4) library(lme4) model1- glmer(validatedRS6 ~ random +

[R] grnn issue

2013-11-05 Thread Cyril Auburtin
I'm trying grnn package, and reproduced the example ( http://cran.r-project.org/web/packages/grnn/grnn.pdf), I tried the example with another x input column in the dataset: but I'm getting the following error Error in Ya * patterns1 : non-conformable arrays, though I took care to pass an input

Re: [R] Error message glmer using R: “ 'what' must be a character string or a function”

2013-11-05 Thread David Winsemius
On Nov 5, 2013, at 3:36 PM, EmmaB wrote: I am running a multi-level model. I use the following commands with validatedRS6 as the outcome, random as the predictor and clustno as the random effects variable. new-as.data.frame(read.delim(BABEX.dat, header=TRUE)) install.packages(lme4)

[R] Finding absolute viewport location in grid / lattice

2013-11-05 Thread James Price
I'm trying to do some post-plot manipulation of some lattice graphics, in which I need to get the absolute viewport locations on the plotting device. So for example: library(lattice) print(xyplot(Petal.Length ~ Sepal.Length | Species, iris, layout = c(2, 2))) trellis.focus('panel', 1, 1) This

Re: [R] Error message glmer using R: “ 'what' must be a character string or a function”

2013-11-05 Thread EmmaB
str(new) 'data.frame': 1214 obs. of 4 variables: $ ï..VAR1 : logi NA NA NA NA NA NA ... $ random : int 1 1 1 1 1 1 1 1 1 1 ... $ clustno : int 1 1 1 1 1 1 1 1 1 1 ... $ validatedRS6: int 0 0 0 0 0 0 0 0 0 0 ... -- View this message in context:

[R] Goodness Of Fit for Nonparametric Copulas

2013-11-05 Thread Cahaya Iman
Hi All, Are there any package to check the GOF for nonparametric copulas using R? Fayyad [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Rugarch issue. Any help would be great!

2013-11-05 Thread Scottyfromaussie
Hi there I'm having a bit of trouble with my code that I'm writing. Essentially I'm trying to do a rolling eGARCH forecast for a dataset, namely DataExplorers which is a portfolio of gold exploration stocks. I'm hoping to get it so that it calculates the eGARCH for each day and refits itself