Re: [R] remove last row of a data frame

2012-12-11 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of e-letter > Sent: Tuesday, December 11, 2012 11:45 PM > To: r-help@r-project.org > Subject: [R] remove last row of a data frame > > Readers, > > For a data set 'a': > > 1 > 2 > 3

Re: [R] long margin text below lattice plot - how to wrap lines?

2012-12-11 Thread Irene Prix
Thanks a million! > - Original Message - > From: Pascal Oettli > Sent: 12/12/12 09:37 AM > To: knallg...@gmx.com > Subject: Re: [R] long margin text below lattice plot - how to wrap lines? > > Hello > > You can insert \n in your text. > > mytext <- textGrob("This is such a very very lon

[R] Matrix multiplication

2012-12-11 Thread annek
Hi, I have a transition matrix T for which I want to find the steady state matrix for. This could be approximated by taking T^n , for large n. T= [ 0.8797 0.0382 0.0527 0.0008 0.02120.8002 0.0041 0.0143 0.09810.0273 0.8802 0.0527 0.00100.1343 0.0630

[R] remove last row of a data frame

2012-12-11 Thread e-letter
Readers, For a data set 'a': 1 2 3 4 Please what is the syntax to remove the last row and create a new object 'b': 1 2 3 Thanks. -- R2151 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting g

Re: [R] long margin text below lattice plot - how to wrap lines?

2012-12-11 Thread Pascal Oettli
Hello You can insert \n in your text. mytext <- textGrob("This is such a very very long text\n that it goes on forever and therefore needs to be wrapped in order\n for someone to be able to read it properly.") HTH Pascal Le 12/12/2012 16:22, knallg...@gmx.com a écrit : Hello, I've got a

[R] long margin text below lattice plot - how to wrap lines?

2012-12-11 Thread knallgrau
Hello, I've got a lattice plot and need to add text into the bottom margin of the plotting area (below the bottom legend). This seems to work in principle using grid.arrange, yet the text to be added is rather long. As a consequence, it gets clipped: require(lattice) require(grid) myplot <- xy

[R] Bayesian Haplotype analysisin R

2012-12-11 Thread knouri
Dear members: Could you please tell me the package for Bayesian haplotype estimation  in R. Currently PHASE is available for such purpose but I need a similar R package. Best regards, Keramat Nourijelyani, PhD Associate Professorof Biostatistics Tehran University

Re: [R] Reassign functions called by other functions in package graphics

2012-12-11 Thread Greg Snow
I think the error is because the other functions are expecting the plot.new function to do some specific things to set up the graphics device for a new plot, but your function did not do those things. You might consider the trace function as an alternative to what you are trying. It can be used t

Re: [R] Multiple palettes on single plot don't get rendered when I use dev.copy2pdf

2012-12-11 Thread Andrew Crane-Droesch
Thanks a lot! This works, provided I run my version first. For posterity, the following does what is wanted: par(mfrow=c(1,1)) x1 = rnorm(1000) x2 = rnorm(1000)+10 y1 = rnorm(1000)+10 y2 = rnorm(1000)+10 palette(rainbow(6)) plot(x=x1,y=y1,col=y1,xlim=c(-10,20)) palette(heat.colors(6)) points(

Re: [R] Multiple palettes on single plot don't get rendered when I use dev.copy2pdf

2012-12-11 Thread arun
Hi, Try this:  pdf("broke.pdf")  palette(rainbow(6))  plot(x=x1,y=y1,col=y1,xlim=c(-10,20))  palette(heat.colors(6))  points(x=x2,y=y2,col=y2)  dev.off() A.K. - Original Message - From: Andrew Crane-Droesch To: R help Cc: Sent: Tuesday, December 11, 2012 7:17 PM Subject: [R] Multiple

[R] Multiple palettes on single plot don't get rendered when I use dev.copy2pdf

2012-12-11 Thread Andrew Crane-Droesch
Hi All, I'm having trouble with the colors on my screen getting translated to the colors in the outputted .pdf document. Here is a caricature of my problem: par(mfrow=c(1,1)) x1 = rnorm(1000) x2 = rnorm(1000)+10 y1 = rnorm(1000)+10 y2 = rnorm(1000)+10 palette(rainbow(6)) plot(x=x1,y=y1,col=y1

Re: [R] questions on French characters in plot

2012-12-11 Thread Duncan Murdoch
On 12-12-10 7:10 PM, Richard Zijdeman wrote: Dear all, I have imported a dataset from Stata using the foreign package. The original data contain French characters such as è and ç . After importing, string variables containing names of French departments have changed. E.g. Ardèche became Ard\x8

[R] Rprof causing R to crash

2012-12-11 Thread Marian Talbert
I'm trying to use Rprof() to identify bottlenecks and speed up a particullary slow section of code which reads in a portion of a tif file and compares each of the values to values of predictors used for model fitting. I've written up an example that anyone can run. Generally temp would be a secti

Re: [R] questions on French characters in plot

2012-12-11 Thread Richard Zijdeman
Dear Milan, please see my results inline On 11 Dec 2012, at 16:58, Milan Bouchet-Valat wrote: > Le mardi 11 décembre 2012 à 16:41 +0100, Richard Zijdeman a écrit : >> Dear Milan, >> >> thank you for kind suggestion. Converting the characters using: >>> iconv(department, "ISO-8859-15", "UTF-8")

Re: [R] Latitudinal mean of values in a data frame

2012-12-11 Thread S.N.Manohar
Thank you very much for all those solutions. On 11-12-12, David Winsemius wrote: > > On Dec 11, 2012, at 3:17 AM, Swagath Navin wrote: > > >Dear all, > > > >I have a big file containing latitude points(-10 to 80) and corresponding > >values. > >Example data > > > >Lat=c(69.48134, 69.49439, 69

Re: [R] Solving Simultaneous nonlinear equations

2012-12-11 Thread Berend Hasselman
On 11-12-2012, at 21:10, Rajibul Mian wrote: > Dear: > > I am having trouble solving simultaneous nonlinear equations by R. I have > been using BBsolve (BB) to do so. Though the function is very strong, still > the program doesn't converge. I have tried all (according to my small > knowledge) th

[R] Solving Simultaneous nonlinear equations

2012-12-11 Thread Rajibul Mian
Dear: I am having trouble solving simultaneous nonlinear equations by R. I have been using BBsolve (BB) to do so. Though the function is very strong, still the program doesn't converge. I have tried all (according to my small knowledge) the options described in the help file. Now I am trying to f

Re: [R] Interpretation of ranef output

2012-12-11 Thread Ben Bolker
Ginnie D Morrison utexas.edu> writes: > I'm running a generalized linear model Note that this is a generalized linear *mixed* model, which complicates the situation somewhat (otherwise you wouldn't be dealing with random effects). Presumably you are using glmer from the lme4 package, but i

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread David Winsemius
On Dec 11, 2012, at 11:14 AM, Steven Ranney wrote: > David and Jim - > > Thanks for your help. Your suggestions worked just fine. Now my task > is to learn why the random-looking string of characters in the first > part of Jim's sub() statement aren't really so random. > Jim's solution can b

Re: [R] Focus on a sub-panel of a splom with trellis.focs() -- return coordinate of sub-panel, or names of variables therein

2012-12-11 Thread ilai
You could try require(grid) trellis.focus() names(iris)[round(unlist(grid.locator()))] trellis.unfocus() cheers On Tue, Dec 11, 2012 at 11:59 AM, Eric Stone wrote: > Hi, > I'd like to be able to generate a splom plot in R and then use my mouse to > click on one of the sub-panels (panel.pairs,

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread Gabor Grothendieck
On Tue, Dec 11, 2012 at 12:46 PM, Steven Ranney wrote: > All - > > I have a column of SiteNames: > > SiteName > OYS-PIA2-FL-1 > OYS-PIA2-LA-1 > OYS-PI-LA-BB-1 > OYS-PIA2-LA-10 > ... > [truncated] > > and I want to include only the last few digits into a new column. > > I tried > > substr(data$Site

Re: [R] debug on lapply

2012-12-11 Thread Duncan Murdoch
On 11/12/2012 1:17 PM, Asis Hallab wrote: Dear R experts, recently I tried to debug a R function with an internal lapply call. When debugging I seem not to be able to use the "n" command to debug the inner function called by lapply. How could I achieve this? Jim gave you one solution. Another

[R] Reassign functions called by other functions in package graphics

2012-12-11 Thread John Kolassa
I am trying to get a function written in R that calls a cascade of functions from the graphics package, and I want to eventually call replacements to functions in the graphics package instead of the originals. Specifically, I have a function that calls qqnorm in stats, which calls qqnorm.defaul

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread arun
HI, You could also use: x <- c("OYS-PIA2-FL-1",  "OYS-PIA2-LA-1",  "OYS-PI-LA-BB-1", "OYS-PIA2-LA-10") gsub(".*\\-(\\d+)$","\\1",x) #[1] "1"  "1"  "1"  "10" #or gsub("[A-Z2-]","",x) #in this case #[1] "1"  "1"  "1"  "10" - Original Message - From: Steven Ranney To: r-help@r-project.

[R] Interpretation of ranef output

2012-12-11 Thread Ginnie D Morrison
Hello. I'm running a generalized linear model and am interested in using the random effects that are output for further analysis. My random effect is interacting with two different fixed effects (which which are factors with two levels each). When I retrieve the random effects I get something like

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread Steven Ranney
David and Jim - Thanks for your help. Your suggestions worked just fine. Now my task is to learn why the random-looking string of characters in the first part of Jim's sub() statement aren't really so random. Thanks again - SR Steven H. Ranney On Tue, Dec 11, 2012 at 11:37 AM, David Winsemiu

[R] Focus on a sub-panel of a splom with trellis.focs() -- return coordinate of sub-panel, or names of variables therein

2012-12-11 Thread Eric Stone
Hi, I'd like to be able to generate a splom plot in R and then use my mouse to click on one of the sub-panels (panel.pairs, specifically) and have R return either the coordinates of that sub-panel, or even better, the names of the corresponding variables plotted in that sub-panel. Here's an exa

Re: [R] debug on lapply

2012-12-11 Thread jim holtman
Typically when I am debugging an 'lapply', I put a browser call inside the lapply function that is being called and then make sure I 'source' in the code instead of copy/paste -- the copy/paste will use any trailing statements after the lapply call as commands to the "browser" function. Here is th

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread David Winsemius
On Dec 11, 2012, at 10:10 AM, jim holtman wrote: try this: x [1] "OYS-PIA2-FL-1" "OYS-PIA2-LA-1" "OYS-PI-LA-BB-1" "OYS-PIA2- LA-10" sub("^.*?([0-9]+)$", "\\1", x) [1] "1" "1" "1" "10" Steve; jim holtman is one of the jewels of the rhelp world. I generally assume that his ans

[R] debug on lapply

2012-12-11 Thread Asis Hallab
Dear R experts, recently I tried to debug a R function with an internal lapply call. When debugging I seem not to be able to use the "n" command to debug the inner function called by lapply. How could I achieve this? *For example:* test <- function( ) { lapply( 1:3, function( x ) x + 1 ) } debu

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread jim holtman
try this: > x [1] "OYS-PIA2-FL-1" "OYS-PIA2-LA-1" "OYS-PI-LA-BB-1" "OYS-PIA2-LA-10" > sub("^.*?([0-9]+)$", "\\1", x) [1] "1" "1" "1" "10" > On Tue, Dec 11, 2012 at 12:46 PM, Steven Ranney wrote: > OYS-PIA2-FL-1 > OYS-PIA2-LA-1 > OYS-PI-LA-BB-1 > OYS-PIA2-LA-10 -- Jim Holtman Data Mung

Re: [R] glm - predict logistic regression - entering the betas manually.

2012-12-11 Thread Greg Snow
It may be overkill, but you can specify the model pieces using the offset function in the model, then the predictions work out (at least for my simple trial case). Something like: fit <- glm( y ~ 0+offset(-1 + 2*x), family=binomial, data=data.frame(y=0, x=0) ) predict( fit, newdata=data.frame(x=s

Re: [R] query multiple terms in PubMed abstract

2012-12-11 Thread David Winsemius
On Dec 11, 2012, at 6:42 AM, email wrote: Hi: I am trying to search PubMed abstracts which contains BOTH two terms: COL4A1 AND Ocular. I am using the following code: url= "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?"; search = paste(url, "db=pubmed&term=COL4A1+AND+Ocular[abstra

[R] Retain last grouping after a strsplit()

2012-12-11 Thread Steven Ranney
All - I have a column of SiteNames: SiteName OYS-PIA2-FL-1 OYS-PIA2-LA-1 OYS-PI-LA-BB-1 OYS-PIA2-LA-10 ... [truncated] and I want to include only the last few digits into a new column. I tried substr(data$SiteName, 13, 20) but because some SiteName values are of a different length, the final

Re: [R] Latitudinal mean of values in a data frame

2012-12-11 Thread David Winsemius
On Dec 11, 2012, at 3:17 AM, Swagath Navin wrote: Dear all, I have a big file containing latitude points(-10 to 80) and corresponding values. Example data Lat=c(69.48134, 69.49439, 69.50736, 69.52026, 69.52438, 69.53308, 69.53746, 69.54365, 69.54582, 69.6884, 69.69272, 69.998, 70.00055,

Re: [R] Latitudinal mean of values in a data frame

2012-12-11 Thread arun
Hi, In addition, you can also use: ?trunc(), ?substr() etc.  aggregate(Value, by = list(floor(Lat)), FUN = function(x) signif(mean(x),2)) #  Group.1    x #1  69 0.18 #2  70 0.16   aggregate(Value, by = list(substr(Lat,1,2)), FUN = function(x) signif(mean(x),2)) #  Group.1    x #1  6

Re: [R] Troubles with subset()

2012-12-11 Thread Virgile Capo-Chichi
Hello all, I have the attached dataset which I read from SPSS and transformed a little bit using the script below. I am trying to run a logistic regression using glm() on a subset of my data. When I run the logistic regression on the whle dataset, it runs OK. As soon as I try to run on the subset,

[R] eigenvector centrality

2012-12-11 Thread Bita Shams
Hello, I need to calculate all eigenvectors of network adjacency matrix. to do this, I called evcent function such as following p2=evcent(g, options=list(nev=2)) where g is my graph and nev is number of required eigenvector but it only calculated first eigenvector and p2$options$nev was stil

Re: [R] Removing named objects using rm(..)

2012-12-11 Thread William Dunlap
By 'testing for existence in a given environment' I meant to use exists(dataName, env=theEnvironment, inherits=FALSE) E.g., > rm(t) > exists("t", envir=globalenv()) [1] TRUE > exists("t", envir=globalenv(), inherits=FALSE) [1] FALSE Look at help("exists") for details. Bill Dunla

Re: [R] Tools for Building Packages (Fedora)

2012-12-11 Thread Marc Schwartz
On Dec 11, 2012, at 9:59 AM, Tony Paredes wrote: > Hello everyone, > > I'm trying to install the tools to build packages under Fedora (17), and > have little luck finding anything useful using Google. I wanted to ask if > there is any documentation associated with this issue; a link will be very

Re: [R] Tools for Building Packages (Fedora)

2012-12-11 Thread Milan Bouchet-Valat
Le mardi 11 décembre 2012 à 10:59 -0500, Tony Paredes a écrit : > Hello everyone, > > I'm trying to install the tools to build packages under Fedora (17), and > have little luck finding anything useful using Google. I wanted to ask if > there is any documentation associated with this issue; a link

[R] Fwd: Troubles with subset()

2012-12-11 Thread Virgile Capo-Chichi
Trying again with a smaller data file. V Hello all, I have the attached dataset which I read from SPSS and transformed a little bit using the script below. I am trying to run a logistic regression using glm() on a subset of my data. When I run the logistic regression on the whle dataset, it ru

Re: [R] Troubles with subset()

2012-12-11 Thread Milan Bouchet-Valat
Le mardi 11 décembre 2012 à 17:18 +0100, Virgile Capo-Chichi a écrit : > Hello all, > > I have the attached dataset which I read from SPSS and transformed a > little bit using the script below. I am trying to run a logistic > regression using glm() on a subset of my data. When I run the logistic >

Re: [R] Troubles with subset()

2012-12-11 Thread Milan Bouchet-Valat
Le mardi 11 décembre 2012 à 15:09 +0100, Virgile Capo-Chichi a écrit : > All, > I have the attached dataset which I read from SPSS and transformed a little > bit using the attached script. I am trying to run a logistic regression > using glm() on a subset of my data. When I run the logistic regress

[R] Tools for Building Packages (Fedora)

2012-12-11 Thread Tony Paredes
Hello everyone, I'm trying to install the tools to build packages under Fedora (17), and have little luck finding anything useful using Google. I wanted to ask if there is any documentation associated with this issue; a link will be very useful. Thank you very much. [[alternative HTML ve

Re: [R] questions on French characters in plot

2012-12-11 Thread Milan Bouchet-Valat
Le mardi 11 décembre 2012 à 16:41 +0100, Richard Zijdeman a écrit : > Dear Milan, > > thank you for kind suggestion. Converting the characters using: > > iconv(department, "ISO-8859-15", "UTF-8") > indeed improves the situation in that now all values (names of > departments) are displayed in the p

[R] VarimpAUC in Party Package

2012-12-11 Thread Peterson, Kim - DNR
Greetings! I'm trying to use function varimpAUC in the party package (party_1.0-3 released September 26th of this year). Unfortunately, I get the following error message: > data.cforest.varimp <- varimpAUC(data.cforest, conditional = TRUE) Error: could not find function "varimpAUC" Was this fun

[R] Variable importance in Party package

2012-12-11 Thread kimpeterson
I'm attempting to use function varimpAUC in the Party package but get a "not found" message. It was reportedly added September 26th to party_1.0-3, so I wonder if it was not included in the Windows binary that I downloaded. Can anyone please tell me how to access this function? Thanks in advance!

[R] query multiple terms in PubMed abstract

2012-12-11 Thread email
Hi: I am trying to search PubMed abstracts which contains BOTH two terms: COL4A1 AND Ocular. I am using the following code: url= "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?"; search = paste(url, "db=pubmed&term=COL4A1+AND+Ocular[abstract]&retmax=300", sep="") docId <- xmlTreeParse

[R] Troubles with subset()

2012-12-11 Thread Virgile Capo-Chichi
All, I have the attached dataset which I read from SPSS and transformed a little bit using the attached script. I am trying to run a logistic regression using glm() on a subset of my data. When I run the logistic regression on the whle dataset, it runs OK. As soon as I try to run on the subset, I g

[R] Comparing Kappa coefficients

2012-12-11 Thread moadeep
I have a simple R script which uses the psych package to calculate cohens kappa (weighted) from a csv file. The csv file has 2 columns of ordinal data - one ranked by an experienced observer and the other by a novice who is undergoing training. What I would like to do is measure kappa for subsets o

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

2012-12-11 Thread arun
HI, You can also try this: df <- data.frame(A=(1:10),B=(1:10),C=(1:10)) df_names <- data.frame(code=c("A","B","D","E","C"),name=c("Col A","Col B","Col D","Col E","Col C")) names(df)<-df_names$name[match(names(df),df_names$code)] A.K. - Original Message - From: Johannes Radinger To: r

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

2012-12-11 Thread arun
HI, Try this:  names(df)<-df_names$name[df_names$code%in%names(df)]  head(df,2) #  Col A Col B Col C #1 1 1 1 #2 2 2 2 A.K. - Original Message - From: Johannes Radinger To: r-help@r-project.org Cc: Sent: Tuesday, December 11, 2012 5:55 AM Subject: [R] Renaming

Re: [R] questions on French characters in plot

2012-12-11 Thread Richard Zijdeman
Dear Milan, thank you for kind suggestion. Converting the characters using: > iconv(department, "ISO-8859-15", "UTF-8") indeed improves the situation in that now all values (names of departments) are displayed in the plot, although the specific special characters are unfortunately appearing as e

Re: [R] Latitudinal mean of values in a data frame

2012-12-11 Thread Rui Barradas
Hello, again. Another possibility is aggregate(Value, by = list(floor(Lat)), FUN = mean) Rui Barradas Em 11-12-2012 11:17, Swagath Navin escreveu: Dear all, I have a big file containing latitude points(-10 to 80) and corresponding values. Example data Lat=c(69.48134, 69.49439, 69.50736, 69

Re: [R] Dispatching on a dgCMatrix does not work.

2012-12-11 Thread Martin Morgan
On 12/11/2012 01:46 PM, Søren Højsgaard wrote: I represent a graph as an adjacency matrix of class "dgCMatrix" (from the Matrix package). xx 5 x 5 sparse Matrix of class "dgCMatrix" a b c d e a . 1 1 . . b 1 . 1 . . c 1 1 . 1 1 d . . 1 . 1 e . . 1 1 . To check if the matrix defines and un

Re: [R] Latitudinal mean of values in a data frame

2012-12-11 Thread Rui Barradas
Hello, Try the following. tapply(Value, floor(Lat), FUN = mean) 6970 0.1805381 0.1617072 Hope this helps, Rui Barradas Em 11-12-2012 11:17, Swagath Navin escreveu: Dear all, I have a big file containing latitude points(-10 to 80) and corresponding values. Example data Lat=

Re: [R] converting manual command to loop command

2012-12-11 Thread Sarah Goslee
Given the same artificial data I provided, this will store all the dist objects in a list: fakedata.dlist <- lapply(1:ncol(fakedata), function(x)dist(fakedata[,x], upper=TRUE, diag=TRUE)) Sarah On Tue, Dec 11, 2012 at 10:15 AM, eliza botto wrote: > Dear Sarah, > thankyou very much it worked...

Re: [R] converting manual command to loop command

2012-12-11 Thread eliza botto
Dear Sarah, thankyou very much it worked... what if i want traditional distance matrices instead of distance column vectors?? i hope i'm not bothering you... thanks in advance eliza > Date: Tue, 11 Dec 2012 09:57:37 -0500 > Subject: Re: [R] converting manual command to loop command > From: s

[R] R users in Sarasota FL

2012-12-11 Thread John Nash
In January I will be visiting Sarasota. The directory of user groups http://blog.revolutionanalytics.com/local-r-groups.html doesn't show any groups in Florida. Contact me off-list if interested in an informal get-together. It might help start another RUG. JN __

Re: [R] converting manual command to loop command

2012-12-11 Thread Sarah Goslee
Does this solve your problem: fakedata <- matrix(runif(100), ncol=10) fakedata.dist <- apply(fakedata, 2, function(x)as.vector(dist(x, upper=TRUE, diag=TRUE))) The columns of the resulting matrix contain the distance vectors. Sarah On Tue, Dec 11, 2012 at 9:45 AM, eliza botto wrote: > > Dear

[R] converting manual command to loop command

2012-12-11 Thread eliza botto
Dear useRs, i have certain commands for some operations in R. They are good if you have a small dataset but my dataset, apart from what i used in the recent past, is prety large. I want to convert these massive sets of commands into a simple loop. Your help is required on it thanks in advance

Re: [R] Removing duplicated values

2012-12-11 Thread Ista Zahn
Hi, On Tue, Dec 11, 2012 at 9:23 AM, Neotropical bat risk assessments wrote: > Hi all, > > I have been away from R for far too many months and have two questions. > One is likely simple, but not found under help or in many of the available R > ref., books. > > 1. How does one save the results of

[R] Removing duplicated values

2012-12-11 Thread Neotropical bat risk assessments
Hi all, I have been away from R for far too many months and have two questions. One is likely simple, but not found under help or in many of the available R ref., books. 1. How does one save the results of an analysis from the main console to a file without the need to copy and paste? 2. W

[R] about difMH, loop, and output

2012-12-11 Thread Yung Chih Ou
Dear all: I have 10 response matrices with missing data. I used difMH to detect DIF items. syntax as: n<-10 difMH<-list() for (i in 1:10){ difMH[[i]]<-difMH(respM[[i]], group="group", focal.name=1 , MHstat="MHChisq", correct=TRUE, exact=FALSE, alpha=0.05, purify=FALSE, nrIter=1

Re: [R] Writing escaped unicode

2012-12-11 Thread David Kulp
Thanks, Jan. Unfortunately I have huge streams of data to transmit and it should be mostly human readable, too, so escape encoding the entire string isn't an option. A workaround is that I found I can use the rjson package as in > cat(toJSON(fromJSON("\"Unicode char: \ufffd\""))) "Unicode char:

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

2012-12-11 Thread Johannes Radinger
Hi, thank you so much, that works perfectly. I used the first suggestion by Anthony (names( df ) <- df_names[ match( names( df ) , df_names[ , 'code' ] ) , 'name' ]). Thank you for the hint about ?match... that was the function I was looking for, makes comparing vectors very easy. best, /Johannes

[R] Dispatching on a dgCMatrix does not work.

2012-12-11 Thread Søren Højsgaard
I represent a graph as an adjacency matrix of class "dgCMatrix" (from the Matrix package). > xx 5 x 5 sparse Matrix of class "dgCMatrix" a b c d e a . 1 1 . . b 1 . 1 . . c 1 1 . 1 1 d . . 1 . 1 e . . 1 1 . To check if the matrix defines and undirected graph, I have made the following functio

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread Rui Barradas
Hello, Inline. Em 11-12-2012 12:04, surekha nagabhushan escreveu: Rui, I have initialized it...doesn't seem to help... result_vector <- vector() No! This must be just before the loop in 'j' result <- vector("list", (length(test1)-1)) for(i in 1:(length(test1)-1)) { for(j in (i+1):length

Re: [R] Get an expected value for Order Statistics by applying double integrals

2012-12-11 Thread kyong park
Thomas, Thanks for enlighting me about using pnorm.The reason I was going to use the double integral was for the cumulative distribution fuction F(X) in the formula. I just tried your method, and it worked which saved me a lot of time. Thanks. Kyong On Thu, Dec 6, 2012 at 3:41 PM, Thomas Stew

Re: [R] Writing escaped unicode

2012-12-11 Thread Duncan Murdoch
On 12-12-11 5:49 AM, Jan T Kim wrote:> On Mon, Dec 10, 2012 at 11:46:40PM -0500, David Kulp wrote: >> I'd like to write unicode strings using the "\u" escape syntax. According to the documentation, print.default or encodeString will escape unicode using the \u convention. In practice, I can't m

Re: [R] Removing named objects using rm(..)

2012-12-11 Thread Duncan Murdoch
On 12-12-11 12:42 AM, Worik R wrote: You may find it more reliable to define an environment in which you will be storing your data (perhaps globalenv(), perhaps something created by new.env()) and then testing for existence of a dataset by a given name in that environment. I did that. PAIR.

Re: [R] Removing named objects using rm(..)

2012-12-11 Thread Duncan Murdoch
On 12-12-10 8:46 PM, Worik R wrote: On Tue, Dec 11, 2012 at 2:27 PM, Duncan Murdoch mailto:murdoch.dun...@gmail.com>> wrote: On 12-12-10 7:33 PM, Worik R wrote: Let me restate my question. Is there a straightforward way of ensuring I can use the variable name

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread surekha nagabhushan
Rui, I have initialized it...doesn't seem to help... result_vector <- vector() result <- vector("list", (length(test1)-1)) for(i in 1:(length(test1)-1)) { for(j in (i+1):length(test1)) { result_vector[j-i] <- agrep(test1[i], test1[j], ignore.case = TRUE, value = TRUE, max.distance = 0.1)

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

2012-12-11 Thread Anthony Damico
df <- data.frame(A=(1:10),B=(1:10),C=(1:10)) # my changes to show that order doesn't matter df_names <- data.frame(code=c("C","A","D","E","B"),name=c("Col C","Col A","Col D","Col E","Col B")) names( df ) <- df_names[ match( names( df ) , df_names[ , 'code' ] ) , 'name' ] for more detail see ?mat

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread Rui Barradas
Hello, See if this is it. You must reinitialize 'result_vector' just before the loop that constructs it. test1 <- c("Vashi", "Vashi,navi Mumbai", "Thane", "Vashi,new Mumbai", "Thana", "Surekha", "Thane(w)", "surekhaN") result <- vector("list", (length(test1)-1)) for(i in 1:(length(te

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread Pascal Oettli
Hello, Right, I didn't notice. Apologies. Pascal Le 11/12/2012 19:55, Rui Barradas a écrit : Hello, And another error in line 2. It should be for(j in (i+1):length(test1)) Hope this helps, Rui Barradas Em 11-12-2012 07:54, Pascal Oettli escreveu: Hi, There is a mistake in the first li

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread surekha nagabhushan
Pascal, result_vector <- vector() result <- vector("list", (length(test1)-1)) for(i in 1:(length(test1)-1)) { for(j in (i+1):length(test1)) { result_vector[j-i] <- agrep(test1[i], test1[j], ignore.case = TRUE, value = TRUE, max.distance = 0.1) } result[[i]]<- result_vector } I'm not sur

[R] Latitudinal mean of values in a data frame

2012-12-11 Thread Swagath Navin
Dear all, I have a big file containing latitude points(-10 to 80) and corresponding values. Example data Lat=c(69.48134, 69.49439, 69.50736, 69.52026, 69.52438, 69.53308, 69.53746, 69.54365, 69.54582, 69.6884, 69.69272, 69.998, 70.00055, 70.00106, 70.00295, 70.00308, 70.00363, 70.00427, 70.0

Re: [R] questions on French characters in plot

2012-12-11 Thread Milan Bouchet-Valat
Le mardi 11 décembre 2012 à 01:10 +0100, Richard Zijdeman a écrit : > Dear all, > > I have imported a dataset from Stata using the foreign package. The > original data contain French characters such as and . > After importing, string variables containing names of French > departments have change

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread Rui Barradas
Hello, And another error in line 2. It should be for(j in (i+1):length(test1)) Hope this helps, Rui Barradas Em 11-12-2012 07:54, Pascal Oettli escreveu: Hi, There is a mistake in the first line. It should be: > for(i in 1:(length(test1)-1)) Regards, Pascal Le 11/12/2012 16:01, surekha

[R] Renaming column names according to another dataframe

2012-12-11 Thread Johannes Radinger
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 name). Now I'd like to use the information (pairs of code and name) of the second dataframe to rename all

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread Pascal Oettli
Hello, Probably because 'result' doesn't have the expected size/number of dimension. How do you create it? Regards, Pascal Le 11/12/2012 19:46, surekha nagabhushan a écrit : Thank you for that Pascal. I changed this bit to the following: result <- vector("list", (length(test1)-1)) for(i i

Re: [R] Writing escaped unicode

2012-12-11 Thread Jan T Kim
On Mon, Dec 10, 2012 at 11:46:40PM -0500, David Kulp wrote: > I'd like to write unicode strings using the "\u" escape syntax. According to > the documentation, print.default or encodeString will escape unicode using > the \u convention. In practice, I can't make it work. > > > b="Unicode chara

Re: [R] How do you use agrep inside a loop

2012-12-11 Thread surekha nagabhushan
Thank you for that Pascal. I changed this bit to the following: result <- vector("list", (length(test1)-1)) for(i in 1:(length(test1)-1)) { for(j in i+1:length(test1)) { result[[i]][j-i] <- agrep(test1[i], test1[j], ignore.case = TRUE, value = TRUE, max.distance = 0.1) } } And now I get

Re: [R] Removing named objects using rm(..)

2012-12-11 Thread Martin Maechler
> "WR" == Worik R > on Tue, 11 Dec 2012 19:59:58 +1300 writes: WR> On Tue, Dec 11, 2012 at 7:49 PM, Jeff Newmiller wrote: >> What about putting your objects in a list, which does not have the search >> through parents semantics? >> ---