[R] Problem with sample session

2014-05-29 Thread Stephen Meskin
While following the suggestion in the manual An Introduction to R to begin with Appendix A, I ran into the problem shown below about 3/4 of the way down the 1st page of App. A. After using the function /attach/, I did not get visible columns in the data frame as indicated but the rather

Re: [R] How to unstack three columns into rows?

2014-05-29 Thread PIKAL Petr
Thanks John Up to now I used reshape package but it seems that I will need to switch to reshape2 if the former starts to be considered ancient. Regards Petr -Original Message- From: John Kane [mailto:jrkrid...@inbox.com] Sent: Wednesday, May 28, 2014 5:13 PM To: PIKAL Petr; Kristi

Re: [R] Dataframe: Average cells of two rows and replace them with one row

2014-05-29 Thread Verena Weinbir
Hello, thank you for your reply. Actually, the whole rows would have to be averaged anyways - my mistake :-) Besides the first column name there is one other string (chr) variable Test in the dataset (the rows I want to average have always the same Testvariable), the other variables are numeric

[R] Redefine `[` for S3 class

2014-05-29 Thread Luca Cerone
Dear all, I have defined my own class myclass using S3 class styles. A myclass objects is just a matrix with some attribute attached. When I subset my myclass the resulting matrix (or vector) doesn't have the attributes attached. I would like to redefine the `[` function for myclass objects (it

Re: [R] Dataframe: Average cells of two rows and replace them with one row

2014-05-29 Thread PIKAL Petr
Hi So what do you want to do with the test variable when averaging? Did you try aggregate function? What was results? Please real data (at least structure) and code you used. Regards Petr From: Verena Weinbir [mailto:vwein...@gmail.com] Sent: Thursday, May 29, 2014 9:48 AM To: PIKAL Petr Cc:

[R] help

2014-05-29 Thread thanoon younis
dear all members i have some problems in R- code below, is there anyone helps me to correct it. many thanks in advance thanoon ## Ridge MM ## rm(list=ls()) library(MASS) library(mvoutlier) library(robustbase) library(car) library(quantreg) n-100 r-0.95

[R] Smoothed HR for interaction term in coxph model

2014-05-29 Thread Lynn Dunsire
Hello R-help members, I have a dataset with 2 treatments and want to assess the effect of a continous covariate on the Hazard ratio between treatment A and B. I want a smoothed interaction term which I have modelled below with the following code: surv.fit - coxph(my.surv ~

Re: [R] Combining data frames

2014-05-29 Thread arun
Hi, You can try ?merge() or ?join() from library(plyr) merge(tempr, pr, by=date,all=TRUE) A.K. Hi, all!  I have a problem. I have 2 data frame. Each contains column: date and one unique column (temperature and pressure correspondingly). But dates are not a same. First one since 1st Jan 2012

Re: [R] Merging by matching two columns

2014-05-29 Thread arun
Hi, I need to merge two data sets but I need them to match two columns, not just one. For example: Hi, If 'dat1` and 'dat2` are the two datasets.  merge(dat1,dat2,by=c(plant.species,insect.species),all=TRUE) #  plant.species insect.species visit.freq no.grains #1   p.A    i.1

Re: [R] Plot regression results with various predictors.

2014-05-29 Thread phil
Thanks a lot for your input. -- View this message in context: http://r.789695.n4.nabble.com/Plot-regression-results-with-various-predictors-tp4691307p4691416.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Confusing behavior when using gsub to insert unicode character (minimal working example provided)

2014-05-29 Thread Thomas Stewart
Thanks to to Ista Zahn, I was able to find a work around solution. The key seems to be that string1 needs to be encoded as UTF-8 prior to being passed to gsub. For whatever reason, Encoding(string1) - UTF-8 does not change the encoding on my Windows machine. The work around: I paste an

Re: [R] Redefine `[` for S3 class

2014-05-29 Thread Bert Gunter
Luca: Well, start by using the correct syntax -- you've misplaced your quotes. Then look at existing code, e.g. base:::[.factor A little effort on your part obviates the need to post here. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information.

Re: [R] how to access an executing environment?

2014-05-29 Thread Greg Snow
I believe that what is happening is that you never run fun1, so no environment for fun1 is ever created and therefore x1 is never defined with its own environment. You grab the statement y - x1 from the body of fun1, but then tries to evaluate it in the current environment (where it cannot find

[R] Help with arrays

2014-05-29 Thread Olivier Charansonney
Hello, I would like to extract the value in row 1 corresponding to the maximum in row 2 Array W [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9][,10] [1,] 651.0 651.0 651.0 651.0 651.0 651.0 651.0 119.0 78.0

Re: [R] how to access an executing environment?

2014-05-29 Thread Spencer Graves
On 5/29/2014 7:40 AM, Greg Snow wrote: I believe that what is happening is that you never run fun1, so no environment for fun1 is ever created and therefore x1 is never defined with its own environment. You grab the statement y - x1 from the body of fun1, but then tries to evaluate it in the

Re: [R] Help with arrays

2014-05-29 Thread Marc Schwartz
On May 29, 2014, at 11:02 AM, Olivier Charansonney olivier.charanson...@orange.fr wrote: Hello, I would like to extract the value in row 1 corresponding to the maximum in row 2 Array W [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]

Re: [R] Help with arrays

2014-05-29 Thread Marc Schwartz
On May 29, 2014, at 11:22 AM, Marc Schwartz marc_schwa...@me.com wrote: On May 29, 2014, at 11:02 AM, Olivier Charansonney olivier.charanson...@orange.fr wrote: Hello, I would like to extract the value in row 1 corresponding to the maximum in row 2 Array W [,1]

Re: [R] Problem with sample session

2014-05-29 Thread Greg Snow
This is a warning and in your case would not be a problem, but it is good to think about and the reason why it is suggested that you avoid using attach and be very careful when you do use attach. What is happening is that you first created a vector named 'x' in your global workspace, you then

Re: [R] help

2014-05-29 Thread Greg Snow
You should probably read the posting guide, there is a link at the bottom of every e-mail on the list. You provide a large amount of code but no description of what you are trying to do with it and very little about what problem you are having. Most people (well me at least) are unwilling to run

[R] saveSWF Error Message: file association not available or invalid

2014-05-29 Thread Cheryl Johnson
When I run the code below, I receive the following error message. Thanks in advance for help with fixing this error message. saveSWF({ code }, img.name = file,swf.name = file2.swf , single.opts = 'utf8': false, autoplay = FALSE , interval = 0.1, imgdir = directory, htmlfile = random.html,

Re: [R] remove duplicated row according to NA condition

2014-05-29 Thread jeff6868
Yes, this is the good one Arun! Thank you very much. I tried each solution but yours was the best. It works well. Thanks anyway for all your replies! -- View this message in context: http://r.789695.n4.nabble.com/remove-duplicated-row-according-to-NA-condition-tp4691362p4691422.html Sent

[R] (no subject)

2014-05-29 Thread marta valdes lopez
Hello, Iam using R 3.1 and i tried to run this script: setwd(C:/users/marta/desktop/DB) library(chron) library(xlsx) filename-univerest_50.csv filename-monicap_50.csv filename-univer1_50.csv filename-univer2_50.csv DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=)

Re: [R] (no subject)

2014-05-29 Thread JLucke
There's a comma missing after sep=). DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=) sep=,,header=TRUE) should be DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=), sep=,,header=TRUE) ^ marta valdes

Re: [R] saveSWF Error Message: file association not available or invalid

2014-05-29 Thread Yihui Xie
This is not a big problem. It just means your system does not have a default program to open .swf files. If you associate, say, a movie player, with .swf, this problem will go away. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Thu, May 29, 2014 at 6:04 AM, Cheryl

[R] referencing a data frame with a pointer, link, alias, etc

2014-05-29 Thread dansawyer
Good afternoon. The question is: does R support pointer like structures? The specific problem is: a function supporting operations on a set of data frames with similar structures. I have a set of data frames with similar structures. I wish to perform similar operations on those data frames. I

[R] Multiple regression in R

2014-05-29 Thread Safiye Celik
I want to perform a multiple regression in R and make predictions based on the trained model. Below is an example code I am using: price = c(10,18,18,11,17) predictors = cbind(c(5,6,3,4,5),c(2,1,8,5,6)) predict(lm(price ~ predictors), data.frame(predictors=matrix(c(3,5),nrow=1))) So, based on

Re: [R] referencing a data frame with a pointer, link, alias, etc

2014-05-29 Thread David Winsemius
On May 29, 2014, at 1:13 PM, dansawyer wrote: Good afternoon. The question is: does R support pointer like structures? The specific problem is: a function supporting operations on a set of data frames with similar structures. I have a set of data frames with similar structures. I

Re: [R] Multiple regression in R

2014-05-29 Thread Safiye Celik
Solved! Here is the solution in case it helps others: The easiest way to get past the issue of matching up variable names from a matrix of covariates to newdata data.frame column names is to put your input data into a data.frame as well. Try this price = c(10,18,18,11,17) predictors =

Re: [R] Multiple regression in R

2014-05-29 Thread Sarah Goslee
Hi, I'd do it like this, making use of data frames and the data argument to lm. traindata - data.frame(price=price, predictor1=predictor1, predictor2=predictor2) testdata - data.frame(predictor1=3, predictor2=5) predict(lm(price ~ ., data=traindata), testdata) Note that you don't have to

Re: [R] Confusing behavior when using gsub to insert unicode character (minimal working example provided)

2014-05-29 Thread Ista Zahn
10Hi Thomas, On Thu, May 29, 2014 at 9:15 AM, Thomas Stewart tgs.public.m...@gmail.com wrote: Thanks to to Ista Zahn, I was able to find a work around solution. The key seems to be that string1 needs to be encoded as UTF-8 prior to being passed to gsub. For whatever reason,

Re: [R] referencing a data frame with a pointer, link, alias, etc

2014-05-29 Thread Jeff Newmiller
Yes and no. There are lists that can hold anything, but for normal objects there are no pass by reference semantics. The exception to that is environments, but that is really a limited scope of usability. That is, you can receive a changed object in the calling scope and choose to overwrite

Re: [R] referencing a data frame with a pointer, link, alias, etc

2014-05-29 Thread Jim Lemon
On Thu, 29 May 2014 01:13:10 PM dansawyer wrote: Good afternoon. The question is: does R support pointer like structures? The specific problem is: a function supporting operations on a set of data frames with similar structures. I have a set of data frames with similar structures. I

Re: [R] referencing a data frame with a pointer, link, alias, etc

2014-05-29 Thread David Winsemius
On May 29, 2014, at 2:54 PM, Dan Sawyer wrote: Thanks for the follow up. I will look into changing the column reverences. Please look into reading the Posting Guide. You are asked NOT to respond privately but rather to the list. As teh footer of every message says: PLEASE do read the

[R] looking at C code from the stats package

2014-05-29 Thread Erin Hodgess
Dear R People: How are you? I would like to look at the underlying C code from the program C_ARIMA_Like in the stats package. However, since that is a base package, I'm not entirely sure how to access this. When I used the .C(C_ARIMA_Like) it says that the C_ARIMA_Like cannot be found.

Re: [R] looking at C code from the stats package

2014-05-29 Thread Marc Schwartz
On May 29, 2014, at 7:12 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: How are you? I would like to look at the underlying C code from the program C_ARIMA_Like in the stats package. However, since that is a base package, I'm not entirely sure how to access this.

Re: [R] looking at C code from the stats package

2014-05-29 Thread Erin Hodgess
Perfect! Thanks so much for your help! Erin On Thu, May 29, 2014 at 8:52 PM, Marc Schwartz marc_schwa...@me.com wrote: On May 29, 2014, at 7:12 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: How are you? I would like to look at the underlying C code from the

Re: [R] looking at C code from the stats package

2014-05-29 Thread Jeff Newmiller
You need to download the R source code to view source code of compiled functions, whether they are C or Fortran or any other compiled language. Are you familiar with compiled languages? --- Jeff Newmiller

Re: [R] Problem with sample session

2014-05-29 Thread Stephen Meskin
Thanks Greg for your response. Is there a work around? Of course this begs the question as to Why is attach part of the sample session in App. A of the introductory manual? All the commands are directly from App. A. Is it possible the configuration of R on my computer is not in accord with

Re: [R-es] ayuda con unexpected symbol

2014-05-29 Thread miguel.angel.rodriguez.muinos
Hola Marta. Tiene pinta de faltar una coma DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=),sep=,,header=TRUE) Un Saludo, Miguel. De: r-help-es-boun...@r-project.org [r-help-es-boun...@r-project.org] en nombre de Marta valdes

Re: [R-es] ayuda con unexpected symbol

2014-05-29 Thread Marta valdes lopez
Hola, Gracias por la rapida respuesta.Si pongo la coma, me dice: Error in file(file,rt):cannot open the connection in addition :warning message: in file(file,rt): cannot open file c:/users/marta/desktop/DB,univer2_50.csv:no such file or directory No se porque me adjunta el ultimo archivo...algo

Re: [R-es] ayuda con unexpected symbol ... correcion omiti un paso ...

2014-05-29 Thread neo
perdon, me salte el paso de lectura del contenido del fichero, corrijo aqui lo que envie: setwd(C:/users/marta/desktop/DB) filename - list.files(path = C:/users/marta/desktop/DB) # este paso es solo para crear un fichero con la misma cantidad de columnas que los que quieres unir, luego puedes