Re: [R] Fwd: Difficulty in finding some R functions

2014-05-02 Thread Pascal Oettli
Hello, Maybe from here ? http://www.ie.boun.edu.tr/~hormannw/BounQuantitiveFinance/Thesis/SilaHALULU.pdf HTH Pascal On Fri, May 2, 2014 at 11:11 AM, prachi jain preciousprachi...@gmail.com wrote: Hey, I am trying to find some of the following functions in R packages: MLEt pt3

[R] substring if a record has a \

2014-05-02 Thread Mat
Hello togehter, i have a litte problem. I have a data.frame with a view entries like this one: 1 A Marius Muller -\nIT Services B Rockwood\nBrockhues C Microlog Services\nMarcos D Firefox Services I now want only the first description in the column until the \n. How can i do this?

[R] extracting the first few eigenvectors

2014-05-02 Thread Mike Miller
I have a symmetric matrix, X, and I just want the first K eigenvectors (those associated with the K largest eigenvalues). Clearly, this works: eigs - eigen( X, symmetric=TRUE ) K_eigenvectors - eigs$vectors[ , 1:K ] K_eigenvalues - eigs$values[ 1:K ] rm(eigs) In order to do that, I have to

Re: [R] substring if a record has a \

2014-05-02 Thread Pascal Oettli
Hello, Something like that? x - c('Marius Muller -\nIT Services','Rockwood\nBrockhues','Microlog Services\nMarcos','Firefox Services') x - sapply(strsplit(x, '\n'), '[', 1) x [1] Marius Muller - Rockwood Microlog Services [4] Firefox Services Regards, Pascal On Fri, May 2, 2014 at

Re: [R] substring if a record has a \

2014-05-02 Thread Mat
works perfect, thank you :-) -- View this message in context: http://r.789695.n4.nabble.com/substring-if-a-record-has-a-n-tp4689857p4689860.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Return TRUE only for first match of values between matrix and vector.

2014-05-02 Thread nevil amos
I wish to return True in a matrix for only the first match of a value per row where the value equals that in a vector with the same number of values as rosw in the matrix eg: A-matrix(c(2,3,2,1,1,2,NA,NA,NA,5,1,0,5,5,5),5,3) B-c(2,1,NA,1,5) desired result: [,1] [,2] [,3] [1,] TRUE FALSE

Re: [R] extracting the first few eigenvectors

2014-05-02 Thread Berend Hasselman
On 02-05-2014, at 09:17, Mike Miller mbmille...@gmail.com wrote: I have a symmetric matrix, X, and I just want the first K eigenvectors (those associated with the K largest eigenvalues). Clearly, this works: eigs - eigen( X, symmetric=TRUE ) K_eigenvectors - eigs$vectors[ , 1:K ]

Re: [R] R and GML data from the Canadian Goverment

2014-05-02 Thread Barry Rowlingson
You want to have a look at the R Spatial Task View for starters... GML files can be read by the rgdal package's readOGR function. But be warned GML is a complex beast. For example, I downloaded canvec_gml_AB_EN.zip from that site, it unzips to a GML (and an xsd) with a lot of layers, some of

Re: [R] Return TRUE only for first match of values between matrix and vector.

2014-05-02 Thread arun
Hi, Try: indx - A==B t(apply(indx,1,function(x) {x[duplicated(x) !is.na(x)] - FALSE; x})) #  [,1]  [,2]  [,3] #[1,]  TRUE FALSE FALSE #[2,] FALSE    NA FALSE #[3,]    NA    NA    NA #[4,]  TRUE    NA FALSE #[5,] FALSE  TRUE FALSE A.K. On Friday, May 2, 2014 4:47 AM, nevil amos

Re: [R] Return TRUE only for first match of values between matrix and vector.

2014-05-02 Thread Jorge I Velez
Hi Nevil, Try apply(A, 2, function(x) x == B) HTH, Jorge.- On Fri, May 2, 2014 at 6:46 PM, nevil amos nevil.a...@gmail.com wrote: I wish to return True in a matrix for only the first match of a value per row where the value equals that in a vector with the same number of values as rosw

Re: [R] substring if a record has a \

2014-05-02 Thread arun
Hi, Try: dat - structure(list(`1` = c(Marius Muller -\nIT Services, Rockwood\nBrockhues, Microlog Services\nMarcos, Firefox Services)), .Names = 1, class = data.frame, row.names = c(A, B, C, D)) dat$`1` - gsub(\n.*,,dat$`1`) dat #  1 #A   Marius Muller - #B  Rockwood

[R] creating multiple orthogonal plans

2014-05-02 Thread David Moskowitz
Hi, I am trying to create multiple orthogonal designs using the Conjoint package. I have 4 factors with 5 levels in each. library(conjoint) experiment-expand.grid( price-c(a1,a2,a3,a4,a5), tag-c(b1,b2,b3,b4,b5), smell-c(c1,c2,c3,c4,c5), aroma-c(f1,f2,f3,f4,f5))

Re: [R] extracting the first few eigenvectors

2014-05-02 Thread Yixuan Qiu
Exactly. The syntax is intended to mimic eigs() in Matlab and Octave. library(rARPACK) eigs(X, 10) # If your X is of class dsyMatrix eigs_sym(X, 10) # If X is of class matrix Best, Yixuan 2014-05-02 4:48 GMT-04:00 Berend Hasselman b...@xs4all.nl: On 02-05-2014, at 09:17, Mike

Re: [R] Adding a column with a count of unique values

2014-05-02 Thread arun
Hi, Try: dat - read.table(text=Person     Time     Change 2     0     3 2     10     5 2     15     7 3     0     4 3     5     2,sep=,header=TRUE) dat1 - transform(dat,Count= ave(rep(1,nrow(dat)), Person, FUN=cumsum)) #or ##If it is ordered by Person dat2 - transform(dat, Count=

Re: [R] speeding up applying hist() over rows of a matrix

2014-05-02 Thread William Dunlap
Your original code, as a function of 'm' and 'bins' is f0 - function (m, bins) { t(apply(m, 1, function(x) hist(x, breaks = bins, plot = FALSE)$counts)) } and the time it takes to run on your m1 is about 5 s. on my machine system.time(r0 - f0(m1,bins)) user system elapsed 4.950.00

Re: [R] speeding up applying hist() over rows of a matrix

2014-05-02 Thread William Dunlap
And since as.integer(cut(x,bins)) is essentially findInterval(x,bins) (since we throw away the labels made by cut()), I tried using findInterval instead of cut() and it cut the time by more than half, so your 5.0 s. is now c. 0.1 s. f3 - function (m, bins) { nbins - length(bins) - 1L m -

[R] Parsing XML file to data frame

2014-05-02 Thread starcraz
Hi all - I am trying to parse out the attached XML file into a data frame. The file is extracted from Hadoop File Services (HFS). I am new in using the XML package so need some help in parsing out the data. Below is some code that I explore to get the attribute into a data frame. Any help is

[R] matafor package: adding additional information under a forest plot

2014-05-02 Thread Dietlinde Schmidt
Dear R-Users, i have to questions about plotting a forest plot with the metafor package: 1) Is there a (text()) function to add additional information (e.g. heterogeneity statistics) under the forest plot? 2) I want to add various columns of additional information about each study (e.g.

[R] How to fix the format in write.csv

2014-05-02 Thread ChangJiang Xu
By dafault, write.csv will change the characters such as 5/38 as a date May-38. How can I not change the format? Thanks. ChangJiang [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Writing to gzcon with rawConnection

2014-05-02 Thread Jamie Olson
I would like to encode/decode some text with deflate/gzip, but I'm having trouble. Decoding values from a rawConnection is fairly straightforward, but I'm having trouble encoding values and then retrieving them. gz_out - gzcon(raw_out - rawConnection(raw(0),open=wb))

Re: [R] How to fix the format in write.csv

2014-05-02 Thread Bert Gunter
Read your Excel documentation. AFAIK, R just writes text files -- you need to tell Excel how to read them in. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert

Re: [R] How to fix the format in write.csv

2014-05-02 Thread Bert Gunter
ChangJiang: Open the .csv file with Notepad or other plain vanilla text processor, NOT EXCEL. You will find that the columns are text. Excel automatically converts them to dates. Read Excel's docs or get help from someone to learn how to convert the dates back to text. -- Bert Bert Gunter

Re: [R] How to fix the format in write.csv

2014-05-02 Thread Jim Lemon
Hi ChangJiang, Date conversion is one of the biggest headaches with Excel. Even if you import those data into Excel and then specify that the column should be text format, it won't convert the values back into what they originally were. Be aware that Excel may, when encountering dates from a

Re: [R] extracting the first few eigenvectors

2014-05-02 Thread Mike Miller
Thank you, and thanks for writing that code! That is the perfect answer to my question. I hope the R development team will consider expanding the functionality of eigen() to include the option to retain only the first few eigenvectors and/or eigenvalues. To me it seems very common in

Re: [R] How to fix the format in write.csv

2014-05-02 Thread ChangJiang Xu
Thanks. I still didn't get the solution. For example, I have a data frame, called temp temp Chr Ref Var AFFUNAFF AFF.test pvalue 1 10 A G 2/1/240/0/1905/49 2.429e-09 2 18 G A 1/9/17 0/23/167 11/43 2.484e-04 3 1 G A 2/2/220/8/176

[R] SQL vs R

2014-05-02 Thread Dr Eberhard Lisse
Hi, How do I do something like this without using sqldf? a - sqldf(SELECT COUNT(*) FROM b WHERE c = 'd') or e - sqldf(SELECT f, COUNT(*) FROM b GROUP BY f ORDER BY f) greetings, el __ R-help@r-project.org mailing list

Re: [R] speeding up applying hist() over rows of a matrix

2014-05-02 Thread Ortiz-Bobea, Ariel
This works great, thanks a lot! -AOB -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Friday, May 02, 2014 12:31 PM To: Ortiz-Bobea, Ariel Cc: r-help@r-project.org Subject: Re: [R] speeding up applying hist() over rows of a matrix And since

[R] Making a panel of scatter plots in R

2014-05-02 Thread Charlie Nagle
Hello, I'm trying to figure out how to panel scatter plots of participant data in R using the ggplot2 package. I do not want to display separate variables, I simply want to create a 4 by 4 or 5 by 5 grid of scatter plots that represent the data of each individual participant since I am looking

Re: [R] Making a panel of scatter plots in R

2014-05-02 Thread Jeff Newmiller
Are you looking for facet_wrap? facet_grid usually has two grouping variables... --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#.

[R] Seeking well-commented versions of mgcv source code

2014-05-02 Thread Andrew Crane-Droesch
Dear List, I'm looking for well-commented versions of various functions comprising mgcv, so that I can modify a piece of it for a project I'm working on. In particular I'm looking for * testStat * summary.gam * liu2 * simf Obviously I can find these by typing mgcv:::whatever. But

Re: [R] SQL vs R

2014-05-02 Thread Carlos Ortega
Hi, With the new package dplyr you can create equivalent SQL sintaxt queries like the one you need. You can find examples of how to apply it here: http://martinsbioblogg.wordpress.com/2014/03/26/using-r-quickly-calculating-summary-statistics-with-dplyr/

Re: [R] Seeking well-commented versions of mgcv source code

2014-05-02 Thread Jeff Newmiller
Read the Posting Guide, which points out that this list is for plain text emails so you should set your email program appropriately. Read the Writing R Extensions document, which tells you how packages are constructed, and from which it will become clear that you want the tar.gz package file

Re: [R] How to fix the format in write.csv

2014-05-02 Thread Duncan Mackay
Hi I second Jim's comments. I have also been bitten by British being converted to American format as well as ANSI numeric to a date format which I did not want . And if you want to take a daily series from the 1890's to the 2000's caveat emptor. If you are dealing with dates use something that

Re: [R] SQL vs R

2014-05-02 Thread Bert Gunter
By making the effort to learn R? See e.g. the Introduction to R tutorial that ships with R. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Fri, May 2,

[R-es] gracias y pregunta off topic

2014-05-02 Thread Fer
Lo primero, muchisimas gracias a los que respondisteis a mis problemas con mapas :-D Luego, aunque la lista sea de R, tengo una duda matematica que quizas podriais responderme. Hay algun palabro en castellano que se utilice para designar los state process y observational process en modelos