[R] Merge two dataframe with "by", and problems with the common field

2013-05-06 Thread jpm miao
Hi, From time to time I merge two dataframes with possibly a common field. Then the common field is no longer present,but what are present fieldname.x and fieldname.y. How can I fix the problem so that I can still call by the orignal fieldname? If you don't understand my problem, please see the

Re: [R] Extracting elements from a matrix using a vector containing indices

2013-05-06 Thread Berend Hasselman
On 07-05-2013, at 06:39, Mark Coletti wrote: > I have a matrix of data that has a corresponding vector of indices. I > would like to use those indices to extract specific matrix elements into a > new vector. In other words, I have an R X C matrix with a corresponding > vector of C elements tha

[R] Extracting elements from a matrix using a vector containing indices

2013-05-06 Thread Mark Coletti
I have a matrix of data that has a corresponding vector of indices. I would like to use those indices to extract specific matrix elements into a new vector. In other words, I have an R X C matrix with a corresponding vector of C elements that have numbers mapping into specific elements of the mat

Re: [R] Bootstrapped Non-Parametric 1-sided Confidence Intervals

2013-05-06 Thread David Winsemius
On May 6, 2013, at 7:11 PM, Janh Anni wrote: > Hello All, > > Is there a way for computing 1-sided confidence intervals for bootstrapped > statistics (mean, median, percentiles, etc.)? It appears the > boot.cifunction in the boot package only computes 2-sided intervals. > Your assistance is gre

[R] Bootstrapped Non-Parametric 1-sided Confidence Intervals

2013-05-06 Thread Janh Anni
Hello All, Is there a way for computing 1-sided confidence intervals for bootstrapped statistics (mean, median, percentiles, etc.)? It appears the boot.cifunction in the boot package only computes 2-sided intervals. Your assistance is greatly appreciated. Regards Janh [[alternative HTML

[R] pR2 stumped

2013-05-06 Thread ivo welch
Dear R experts: I am stumped.I am trying to pick off the mcfadden R^2 for a probit. simple, me thinks---except my code works only in my main program, but not in my sub!?I am probably doing something obviously wrong, but I have stared at my code for a while now and I feel even more stupid

[R] rowspan and readHTMLTable

2013-05-06 Thread Chris Stubben
I'm trying to read html tables with lots of rowspan attributes, for example... x<-htmlParse(" abX YZ c ") readHTMLTable(x, which=1) V1 V2 1 abX 2 YZ 3 c Does anyone know how to use the rowspan attributes and repeat cell values to format a table like this? V1 V2 1 abX

Re: [R] replace data by a rule

2013-05-06 Thread Rui Barradas
Hello, Like this? x = data.frame(id = 1:8, f1 = LETTERS[1:8]) idx <- 5 <= x$id & x$id <= 8 x$id[idx] <- x$id[idx] - 4 x Hope this helps, Rui Barradas Em 06-05-2013 22:29, Hui Du escreveu: Hi All, I have data set like x = data.frame(id = 1:8, f1 = LETTERS[1:8]) I want to replace id 5, 6, 7

Re: [R] replace data by a rule

2013-05-06 Thread arun
Hi, library(car) set.seed(25)  x1<- data.frame(id=sample(1:8,8,replace=FALSE),f1=LETTERS[1:8])  x1$id<-recode(x1$id,'5=1;6=2;7=3;8=4') x1 #  id f1 #1  4  A #2  1  B #3  1  C #4  3  D #5  2  E #6  3  F #7  2  G #8  4  H A.K. - Original Message - From: Hui Du To: "r-help@r-project.org"

Re: [R] Using Rscript in version 3.0.0

2013-05-06 Thread Rolf Turner
On 07/05/13 02:10, Ken Weiss wrote: Greetings, I have just installed version 3.0.0. I am trying to use code that I have used numerous times in previous versions of R. My code executes correctly until I try to call makePSOCKcluster. I issue the following command and get the following error: >

Re: [R] Some unrelated questions.

2013-05-06 Thread Jim Lemon
see inline On 05/07/2013 02:14 AM, Keith S Weintraub wrote: Folks, I have been working on an R project that has a few dozen functions. I have some questions that are only tangentially related and might only be a difference in style. 1. Some of my functions take single-row data.frames as inpu

[R] replace data by a rule

2013-05-06 Thread Hui Du
Hi All, I have data set like x = data.frame(id = 1:8, f1 = LETTERS[1:8]) I want to replace id 5, 6, 7, 8 by 1, 2, 3, 4 respectively. e.g the map is ID-1 ID-2 5 1 6 2 7 3 8 4 I have lots of data and rules. How to do it in a few lines rather than do them one by one like: x[x$id == 5,

Re: [R] State space models with regime switching

2013-05-06 Thread Rui Barradas
Hello, Maybe package tsDyn. It implements SETAR and LSTAR models, among others. Hope this helps, Rui Barradas Em 06-05-2013 21:28, David Hoppe escreveu: Hello everyone, I'm new to this mailing list, but i hope this is the right place to post my question. I'm trying to do some time series ana

Re: [R] State space models with regime switching

2013-05-06 Thread David Winsemius
On May 6, 2013, at 1:28 PM, David Hoppe wrote: > Hello everyone, > > I'm new to this mailing list, but i hope this is the right place to > post my question. I'm trying to do some time series analysis with > state space models in R. So far I used the packages dse and dlm. I was > wondering if the

[R] State space models with regime switching

2013-05-06 Thread David Hoppe
Hello everyone, I'm new to this mailing list, but i hope this is the right place to post my question. I'm trying to do some time series analysis with state space models in R. So far I used the packages dse and dlm. I was wondering if there is a package, which allows for regime switching state spac

Re: [R] R package for bootstrapping (comparing two quadratic regression models)

2013-05-06 Thread Elaine Kuo
Thanks Jean. Y1 = observed value Y2= estimated value Elaine On Mon, May 6, 2013 at 9:22 PM, Adams, Jean wrote: > Elaine, > > I suggest that you consult with a statistician to see if it even makes > sense to compare the two models you describe. The first model makes sense > to me, the second o

[R] topGO printGenes

2013-05-06 Thread Charles Determan Jr
Greetings R users, I have a rather specific question I hope someone could assist me with. I have been using the topGO package for some Gene Ontology analysis of some RNA-seq data. As such I use a organism database from the biomaRt library. I can create a topGOdata object with the following comma

Re: [R] Retrieve specific y for a list of x on a ploted line

2013-05-06 Thread Bert Gunter
Camille: 1. Your English is way better than my French! 2. Please re-read the Help file for predict.smooth.spline. Does not the x argument allow you to do exactly what you want? If not, please explain why not. -- Bert On Mon, May 6, 2013 at 12:27 PM, camille rérolle wrote: > Sorry for my bad ex

[R] filtering with fft

2013-05-06 Thread M Pa
Hello, I would like to eliminate 2dx waves from a 2d array. How to do that using fft (or other package)? (I know someone will ask is if this is a homework question - it is not) Thanks, Mark [[alternative HTML version deleted]] __ R-help@r-projec

Re: [R] Retrieve specific y for a list of x on a ploted line

2013-05-06 Thread camille rérolle
Sorry for my bad explanation (french people don't speak english well , it is known). I tried predict.smooth.spline and it's working. The aim of this work was to extract the y for x=1, x=2, x=3 etc on the ploted line. Thank you for your time. Best Regards Camille REROLLE 2013/5/6 Bert Gunter :

Re: [R] negative correlation with corSymm in nlme or another way?

2013-05-06 Thread Kevin Wright
1. Next time you might try emailing the mixed-effects mailing list. 2. Maybe I'm missing some detail about your example, but have you considered corAR1()? Here is an example with negative correlation: library(agridat) dat <- kempton.competition # Fixed genotype effects, random rep effects, # Aut

[R] FW: gamma shared frialty model

2013-05-06 Thread Qiao, Shan
Dear Professor R users, My name is Shan. I am currently a second year master student in statistics in the University of Saskatchewan. I use the gamma shared frailty model to modeling the recurrent data. Following is example of my code and results. > fit<-coxp

Re: [R] Some unrelated questions.

2013-05-06 Thread Bert Gunter
1. I would not presume to "advise" on good style. However, I will note that for your question (1) , default arguments and the "..." argument appears to be more standard. e.g. the function should be written as: myfunc(a1, a2, a3= something1, a4 = something2, ...) where arguments a1 and a2 are requ

Re: [R] how to use Excel VBA's Shell() to call and execute R file

2013-05-06 Thread kuna_matata
I realize this is an old post, but thought it's good to answer for other folks that hit it during a search. RExcel is fantastic. However, it requires all the users to install RExcel. So the VBA approach may still be a good alternative in some simple cases, like the example question. I think what

[R] Some unrelated questions.

2013-05-06 Thread Keith S Weintraub
Folks, I have been working on an R project that has a few dozen functions. I have some questions that are only tangentially related and might only be a difference in style. 1. Some of my functions take single-row data.frames as input parameters lists. I don't force the user of the function to

Re: [R] ArimaLike NaN return

2013-05-06 Thread Matwey V. Kornilov
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14682 Ok, understood. I'll try to make a patch with a fix using solution suggested. 05.05.2013 16:19, Matwey V. Kornilov пишет: Hi, > sessionInfo() R version 3.0.0 (2013-04-03) Platform: x86_64-unknown-linux-gnu (64-bit) I am experienc

[R] a huge sparse matrix to pass into svm

2013-05-06 Thread Yi Yuan
Hi all, I have a huge sparse matrix, it's 360K*210K. Right now I have all the nonzero elements and their indices, so I want to transform this information into a sparse matrix so that I could pass the sparse matrix into svm function. I was planning to use sparse_matrix<- as.matrix.csr(v,nrow=36

Re: [R] Retrieve specific y for a list of x on a ploted line

2013-05-06 Thread Bert Gunter
With the same possibility of misunderstanding as Rui, this sort of question is generally answered by predict() methods, in this case: ?predict.smooth.spline -- Bert On Mon, May 6, 2013 at 8:26 AM, Rui Barradas wrote: > Hello, > > I'm not sure I understand. If you assign the value of smooth.spl

Re: [R] Retrieve specific y for a list of x on a ploted line

2013-05-06 Thread Rui Barradas
Hello, I'm not sure I understand. If you assign the value of smooth.spline, you'll have a list with elements x and y: dat <- read.table(text = " X Y 10137.65916667 22.502152.6233 34.998162.3913 47.501170.7537 59.997174.87

Re: [R] Error running caret's gbm train function with new version of caret

2013-05-06 Thread Max Kuhn
Katrina, I made some changes to accomidate gbm's new feature for 3+ categories, then had to "harmonize" how gbm and caret work together. I have a new version of caret that is not released yet (maybe within a month), but you should get it from: install.packages("caret", repos="http://R-Forge.R

Re: [R] Replace the missing values with column mean values?

2013-05-06 Thread arun
set.seed(25) dat1<- as.data.frame(matrix(sample(c(1:20,NA),10*20,replace=TRUE),ncol=20)) dat2<- dat1 vec1<-colMeans(dat1,na.rm=TRUE)  dat2[]<-lapply(seq_len(ncol(dat1)),function(i) {x<-dat1[,i]; x[is.na(x)]<- vec1[i];x}) dat2<-signif(dat2,digits=3)  dat2 A.K. >I have Data frame with 20 variabl

[R] Using Rscript in version 3.0.0

2013-05-06 Thread Ken Weiss
Greetings, I have just installed version 3.0.0. I am trying to use code that I have used numerous times in previous versions of R. My code executes correctly until I try to call makePSOCKcluster. I issue the following command and get the following error: > cluster <- makePSOCKcluster(nodes, p

[R] How are feature weights extracted from 'superpc' analysis?

2013-05-06 Thread Yukti Choudhury
Hi, I am running 'superpc' to model a supervised principal component predictor to predict survival and I am having problems extracting feature weights to derive a formula for calculating a score. I am new to R so please pardon if the solution is obvious. After running superpc.predict.red to form

[R] Retrieve specific y for a list of x on a ploted line

2013-05-06 Thread camille rérolle
Dear list, I'm trying to retrieve specific y for a list of x on a drawn line in the plot area. The line is plot with an other list of xy coordinates,which only serve to plot the line. Here is an example of the beginning of a table of initial coordinates which permit to draw the line: X

Re: [R] Very basic statistics in R

2013-05-06 Thread Marius 't Hart
Dear Xavier, Jeffs answer was to point out two things to you: 1: How to find these functions on your own. 2: These functions are definitely available in R Good luck, Marius On Mon, 6 May 2013, Xavier Prudent wrote: Dear Jeff, Thanks for your fast answer, I could for sure implement the 2-line

Re: [R] R package for bootstrapping (comparing two quadratic regression models)

2013-05-06 Thread Adams, Jean
Elaine, I suggest that you consult with a statistician to see if it even makes sense to compare the two models you describe. The first model makes sense to me, the second one does not. Isn't y2 in the second equation equal to the estimated y1 from the first equation? You need to talk with someo

Re: [R] xyplot legend : simple question

2013-05-06 Thread Adel ESSAFI
Thank you maybe the argument sep of interaction() helps you. Try > > interaction( g[,1], g[,2], sep = "/") > > Regards -- Gerrit > > > > I am using this command to draw the figure attached to this mail. >> >> xyplot(g[,4]~g[,3],type="b",**group=interaction(g[,1],g[,2])**, auto.key >> =list( tit

Re: [R] xyplot legend : simple question

2013-05-06 Thread Adel ESSAFI
thank you 2013/5/6 Gerrit Eichner > Hello, Adel, > > maybe the argument sep of interaction() helps you. Try > > interaction( g[,1], g[,2], sep = "/") > > Regards -- Gerrit > > > > I am using this command to draw the figure attached to this mail. >> >> xyplot(g[,4]~g[,3],type="b",**group=inter

[R] Release plans: R-3.0.1 on May 16

2013-05-06 Thread Peter Dalgaard
We intend to have a patch release version on May 16. The nickname will be "Good Sport". Apologies for the somewhat belated announcement. -- Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd...

Re: [R] Very basic statistics in R

2013-05-06 Thread arun
Hi,  set.seed(15)  vec1<- sample(1:15,10,replace=TRUE)  mean(vec1) #[1] 10  sd(vec1) #[1] 4.346135  stErr<- sd(vec1)/sqrt(length(vec1))  stErr #[1] 1.374369 library(plotrix)  std.error(vec1) #[1] 1.374369 A.K. - Original Message - From: Xavier Prudent To: S Ellison Cc: "r-help@r-proje

Re: [R] xyplot legend : simple question

2013-05-06 Thread Gerrit Eichner
Hello, Adel, maybe the argument sep of interaction() helps you. Try interaction( g[,1], g[,2], sep = "/") Regards -- Gerrit I am using this command to draw the figure attached to this mail. xyplot(g[,4]~g[,3],type="b",group=interaction(g[,1],g[,2]), auto.key =list( title="Evolution de la

Re: [R] How can I access the rowname of a data?

2013-05-06 Thread arun
Hi, rownames(a) # [1] "4"   "5"   "6"   "7"   "8"   "9"   "11"  "12"  "13"  "15"  "16"  "17" #[13] "18"  "21"  "40"  "48"  "50"  "52"  "53"  "54"  "81"  "101" "102" "103" #[25] "108" "118" "147" "803" "805" "806" "807" "808" "809" "810" "812" "814" #[37] "815" "816" "822" "825"  rownames(a1)  #[1]

Re: [R] slope coefficient of a quadratic regression bootstrap

2013-05-06 Thread Rui Barradas
Hello, You probably mean fit2 <-lm(logDIS~logBMN+I(logBMN^2), data=d) # d, not dataN Hope this helps, Rui Barradas Em 06-05-2013 00:51, Elaine Kuo escreveu: Hello all, I found the following code worked. code require(boot) function.fit2 <- function(data,i){ d <- data[i,] #

Re: [R] Counting number of consecutive occurrences per rows

2013-05-06 Thread PIKAL Petr
Hi I slightly modified Jim's code first part is function to split data frame test according to act, juln and day and compute repetitions in each chunk. fff<- function(x) { fac <- factor((x[, "act"]==0)*1+(x[,"act"] == 200)*2, levels=c(1,0,2)) int<-interaction(x[,"juln"], x[,"day"], fac) res <-

Re: [R] No Ukraine in maps library?

2013-05-06 Thread Ray Brownrigg
You are correct that the "map is rather stale". It is based on data available before the split of the former Soviet Union, and that data is not available for current country boundaries. You would be best advised to use one of the other map-generating packages, which uses more readily availabl

Re: [R] BIOENV

2013-05-06 Thread Jari Oksanen
Hello Gilson, On 06/05/2013, at 05:34 AM, Gilson Carvalho wrote: > Dear all, > > Does anyone knows why the results of a BIOENV (PRIMER v. 6.1.15) are diferent > of the bioenv() + mantel() in vegan? Not the spearman correlation, indeed the > pseudo-p value. > > I know that the approach bioenv(

Re: [R] How can I access the rowname of a data?

2013-05-06 Thread Jorge I Velez
rownames(a) perhaps? HTH, Jorge.- On Mon, May 6, 2013 at 6:03 PM, jpm miao wrote: > Hi, > >Below is the output from an R package. The first column (4, 5, 6, 7, > which is unnamed) is the company name (code), while the second column > efficiency is the performance of each company, which is

[R] How can I access the rowname of a data?

2013-05-06 Thread jpm miao
Hi, Below is the output from an R package. The first column (4, 5, 6, 7, which is unnamed) is the company name (code), while the second column efficiency is the performance of each company, which is the primary output result. How can I access the first column, rowname, 4, 5, 6, 7, 8, 9, 11? Ho

Re: [R] Adjust cex to fit width

2013-05-06 Thread Prof Brian Ripley
This does depend on the unstated device. But on most devices the string width is either exactly or approximately proportional to cex. Some devices cannot scale fonts so there is a small set of available sizes: in which case you can use uniroot() to find the cex corresponding to the closest f

[R] Adjust cex to fit width

2013-05-06 Thread Dario Beraldi
Hello, I need to add some text to a plot and I would like this text to be of a given width in user coordinates. I know I can get the width of a string for a given cex using strwidth. But how can I do the other way around? How can I get the cex value that will make my string of a given width (at l

[R] No Ukraine in maps library?

2013-05-06 Thread Hamid Bazzaz
Hello folks, I am trying to use maps library to visualize a metric over the world map. But I notice that the world map is rather stale. For instance, I don't see any Ukraine country in the set of countries. I wonder if anyone else has run into this before. Is there a newer library to use for such

Re: [R] Very basic statistics in R

2013-05-06 Thread Xavier Prudent
Dear Jeff, Thanks for your fast answer, I could for sure implement the 2-lines code to calculate the uncertainties, but I am astonished that a widespread statistics package like R does not include these very basic quantities. Regards, Xavier 2013/5/3 S Ellison > > > > - the mean