[R] Extracting factors from factanal

2013-01-02 Thread Virgile Capo-Chichi
Dear R users Happy New year to all for a start. Below is some data that I ran a factor analysis on. Using $score prints the scores for each of the three factors. However, I would like to access those factors as variable for new computations. How do I do that? In SPSS we just call fact1_1, fact2_1

Re: [R] Extracting factors from factanal

2013-01-02 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Virgile Capo-Chichi Sent: Wednesday, January 02, 2013 9:33 AM To: R help Subject: [R] Extracting factors from factanal Dear R users Happy New year to all for a start.

Re: [R] Extracting factors from factanal

2013-01-02 Thread Virgile Capo-Chichi
Thanks Petr, very useful. Still, I need to link the scores to individual observations in my original data frame. Is that possible? V 2013/1/2 PIKAL Petr petr.pi...@precheza.cz Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On

Re: [R] Extracting factors from factanal

2013-01-02 Thread PIKAL Petr
Hi I am not at all an expert in factor analysis but I would say that myscores[1,1] is a value of factor1 for the first row of your data frame. How would you like the link to be performed. Easiest way seems to me cbind your data frame with myscores. m2 - cbind(m1, myscores) However grater

Re: [R] Extracting factors from factanal

2013-01-02 Thread Virgile Capo-Chichi
Dear Petr, I tried that and it worked! Thanks, V 2013/1/2 PIKAL Petr petr.pi...@precheza.cz Hi I am not at all an expert in factor analysis but I would say that ** ** myscores[1,1] ** ** is a value of factor1 for the first row of your data frame. How would you like the

Re: [R] Extracting factors from factanal

2013-01-02 Thread Prof Brian Ripley
On 02/01/2013 10:34, PIKAL Petr wrote: Hi I am not at all an expert in factor analysis but I would say that myscores[1,1] is a value of factor1 for the first row of your data frame. How would you like the link to be performed. Easiest way seems to me cbind your data frame with myscores. m2

[R] Package check using --as-cran

2013-01-02 Thread Marc Girondot
I use R 2.15.2 on MacosX 10.8.2 I have a problem checking for a package that I want to submit in CRAN. When I check like that, no problem or warning are detected. system(R CMD check '[path]/phenology') I create the .tar.gz package with that. The file phenology_3.43.tar.gz is generated. I can

[R] In which column and in which row a number is in a matrix

2013-01-02 Thread Charles Novaes de Santana
Dear all, Happy New Year for all of you! I hope we have an year of essential freedom for everyone! I am trying to manipulate a matrix in order to know in which column and in which row a number is allocated. But, when we use the function which it returns the position of the number in the vector

Re: [R] In which column and in which row a number is in a matrix

2013-01-02 Thread Gerrit Eichner
Hi, Charles, see ?which and learn about the argument arr.ind. Happy new year -- Gerrit On Wed, 2 Jan 2013, Charles Novaes de Santana wrote: Dear all, Happy New Year for all of you! I hope we have an year of essential freedom for everyone! I am trying to manipulate a matrix in order to

Re: [R] In which column and in which row a number is in a matrix

2013-01-02 Thread Charles Novaes de Santana
Ups... sorry, guys! Basic mistake: I forgot to look for the information in the help of the function. Thank you, Gerrit, for the information! All the best! Charles On Wed, Jan 2, 2013 at 12:21 PM, Gerrit Eichner gerrit.eich...@math.uni-giessen.de wrote: Hi, Charles, see ?which and learn

[R] listing all test functions in base R

2013-01-02 Thread Data Analytics Corp.
Hi, Is there a way to create a list of all statistical test functions in base R? For example, there's t.test, ks.test, chisq.test, etc. I'd like to create a list of these test names because I keep looking for different tests but never know what's available. I'm thinking of a regular

Re: [R] listing all test functions in base R

2013-01-02 Thread Prof Brian Ripley
On 02/01/2013 12:40, Data Analytics Corp. wrote: Hi, Is there a way to create a list of all statistical test functions in base R? For example, there's t.test, ks.test, chisq.test, etc. I'd like to create a list of these test names because I keep looking for different tests but never know

[R] column selection

2013-01-02 Thread eliza botto
Dear R users, sorry for a very basic question. i wanted to ask that if your column are too much in number and you want to select the remaining columns, starting from column number 117. one way is to use usual command q[ ,(117:2300)]. is there a way by which i can select the remaining columns

Re: [R] column selection

2013-01-02 Thread Berend Hasselman
On 02-01-2013, at 14:59, eliza botto eliza_bo...@hotmail.com wrote: Dear R users, sorry for a very basic question. i wanted to ask that if your column are too much in number and you want to select the remaining columns, starting from column number 117. one way is to use usual command

Re: [R] column selection

2013-01-02 Thread Jorge I Velez
Hmmm... May be q[, 117:ncol(q)] And, by the way, do not use q as the name for your data.frame() or matrix() as it is a reserved name. See ?q and require(fortunes) fortune('dog') for reasons why. HTH, Jorge.- On Thu, Jan 3, 2013 at 12:59 AM, eliza botto wrote: Dear R users, sorry for a

Re: [R] column selection

2013-01-02 Thread ONKELINX, Thierry
You have two options. Q[, 117:ncol(Q)] Or using the negation, thus not selecting the first 116 cols. Q[, -1:-116] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance

[R] problem when installing a R package

2013-01-02 Thread pmouilhade
Hello all and happy new year !!! I had a package that worked fine but since I switched to R 2.15.2, It is not compatible anymore (I have the error message: not installed for 'arch=i386'). I have therefore updated Rtools 2.16 and Path variables as follow:

Re: [R] column selection

2013-01-02 Thread arun
HI, May be this helps: set.seed(5) dat1-as.data.frame(matrix(sample(1:100,100,replace=TRUE),ncol=20)) dat1[,8:ncol(dat1)] A.K. - Original Message - From: eliza botto eliza_bo...@hotmail.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Wednesday, January 2, 2013 8:59 AM

Re: [R] In which column and in which row a number is in a matrix

2013-01-02 Thread arun
HI, Try this: which(mata==4,arr.ind=TRUE) # row col #[1,]   1   2  which(matb==4,arr.ind=TRUE) # row col #[1,]   3   1 A.K. - Original Message - From: Charles Novaes de Santana charles.sant...@gmail.com To: r-help@r-project.org Cc: Sent: Wednesday, January 2, 2013 6:12 AM

Re: [R] listing all test functions in base R

2013-01-02 Thread M.Gagolewski
On 02.01.2013 13:40, Data Analytics Corp. wrote: Is there a way to create a list of all statistical test functions in base R? For example, there's t.test, ks.test, chisq.test, etc. I'd like to create a list of these test names because I keep looking for different tests but never know what's

Re: [R] problem when installing a R package

2013-01-02 Thread pmouilhade
Hi everybody, I have tried the following command to skip the load test: R CMD INSTALL --build --no-test-load DistributionS4 Now the error is the excution of zip failed... Any clue ? -- View this message in context:

Re: [R] translate grouped data to their centroid

2013-01-02 Thread Michael Friendly
On 1/1/2013 3:43 PM, Prof Brian Ripley wrote: On 01/01/2013 19:50, Michael Friendly wrote: Given a data set with a group factor, I want to translate the numeric variables to their centroid, by subtracting out the group means (adding back the grand means). ... Yes. It is part of the

Re: [R] Plot survival analysis with time dependent variables

2013-01-02 Thread Terry Therneau
On 01/01/2013 05:00 AM, r-help-requ...@r-project.org wrote: Dear all, Is there an implementation of Simon Makuch method of plotting the survival function with time-dependent variables. I?m only able to find event.chart in Hmisc for the purpose and I would prefer the Simon and Makuch method.

Re: [R] problem when installing a R package

2013-01-02 Thread Uwe Ligges
On 02.01.2013 13:06, pmouilhade wrote: Hello all and happy new year !!! I had a package that worked fine but since I switched to R 2.15.2, It is not compatible anymore (I have the error message: not installed for 'arch=i386'). I have therefore updated Rtools 2.16 and Path variables as

Re: [R] problem when installing a R package

2013-01-02 Thread Uwe Ligges
On 02.01.2013 14:38, pmouilhade wrote: Hi everybody, I have tried the following command to skip the load test: R CMD INSTALL --build --no-test-load DistributionS4 I missed this message before. Now the error is the excution of zip failed... So your Rtools are not properly installed?

Re: [R] Package check using --as-cran

2013-01-02 Thread Uwe Ligges
On 02.01.2013 11:58, Marc Girondot wrote: I use R 2.15.2 on MacosX 10.8.2 I have a problem checking for a package that I want to submit in CRAN. When I check like that, no problem or warning are detected. system(R CMD check '[path]/phenology') I create the .tar.gz package with that. The

[R] Read many cvs files

2013-01-02 Thread Dominic Roye
Hello R helpers, I would like to automate this code for many files of the same type. But I don´t know how to make it. In particular, i don´t know how to read many files each one as an r object with the name of the file. Then a for loop would be sufficient, right? Many thanks and a happy new

Re: [R] Package check using --as-cran

2013-01-02 Thread Marc Girondot
Le 02/01/13 16:03, Uwe Ligges a écrit : On 02.01.2013 11:58, Marc Girondot wrote: I use R 2.15.2 on MacosX 10.8.2 I have a problem checking for a package that I want to submit in CRAN. When I check like that, no problem or warning are detected. system(R CMD check '[path]/phenology') I

[R] Plot of Fine and Gray model

2013-01-02 Thread Laura Bonnett
Dear all, Happy New year! I have used the 'crr' function to fit the 'proportional subdistribution hazards' regression model described in Fine and Gray (1999). dat1 is a three column dataset where: - ccr is the time to event variable - Crcens is an indicator variable equal to 0 if the event was

Re: [R] Package check using --as-cran

2013-01-02 Thread Uwe Ligges
On 02.01.2013 17:28, Marc Girondot wrote: Le 02/01/13 16:03, Uwe Ligges a écrit : On 02.01.2013 11:58, Marc Girondot wrote: I use R 2.15.2 on MacosX 10.8.2 I have a problem checking for a package that I want to submit in CRAN. When I check like that, no problem or warning are detected.

Re: [R] Read many cvs files

2013-01-02 Thread jim holtman
You can read the files into a list -- you don't want to create unique object names for each one. files - list.files(..pattern to match files..) results - lapply(files, read.table, header = TRUE) On Wed, Jan 2, 2013 at 10:14 AM, Dominic Roye dominic.r...@gmail.com wrote: Hello R helpers, I

[R] loop correction needed

2013-01-02 Thread eliza botto
Dear useRs, i have a data frame with 16 lists in it. each list has variable number of lines. i want to create a loop which will start deleting every 32nd line in each list, till the end of each list. more precisely if a list has 200 rows i want to delete row number 32, 64, 96 and so on...for

Re: [R] Read many cvs files

2013-01-02 Thread jim holtman
use the XLConnect package to read/write Excel workbooks. It handles multiple sheets just fine. On Wed, Jan 2, 2013 at 12:03 PM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: I know that R can read cvs file, but could R read excel files? For example, in the workbook, I have 3 sheets. How

Re: [R] Problem to load a shape file

2013-01-02 Thread MacQueen, Don
What does the unzip(temp, Brasil.shp) function produce? A shapefile is actually several files, and all must be present in order to read the shapefile. I'd also suggest r-sig-geo for this kind of question. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627

Re: [R] loop correction needed

2013-01-02 Thread David Winsemius
On Jan 2, 2013, at 9:00 AM, eliza botto wrote: Dear useRs, i have a data frame with 16 lists in it. each list has variable number of lines. i want to create a loop which will start deleting every 32nd line in each list, till the end of each list. more precisely if a list has 200 rows i

[R] Need help with self-defined function to perform nonlinear regression and get prediction interval

2013-01-02 Thread tn85
Dear All, I was trying to call a self-defined function that performs nonlinear regression and gets the corresponding prediction upper limit using nls2 package. However, weird thing happened. When I called the function in the main program, an error message fitted(nlsmodel): object 'nlsmodel' not

[R] SIGN.test

2013-01-02 Thread solafah bh
Hello I used SIGN.test function in R 2.12.2 to apply one sample sign test and it is worked well ,but I want to put statistic in a variable and I could not get this value, I used : x=rnorm(100) t=SIGN.test(x,md=0,alt=less) t$rval[1]$statistic   the last command work in the old version of R but

Re: [R] SIGN.test

2013-01-02 Thread David Winsemius
On Jan 2, 2013, at 10:45 AM, solafah bh wrote: Hello I used SIGN.test function in R 2.12.2 to apply one sample sign test and it is worked well ,but I want to put statistic in a variable and I could not get this value, I used : x=rnorm(100) t=SIGN.test(x,md=0,alt=less) t$rval[1]$statistic

[R] How to use geom_line (from ggplot) with aesthetics in a function?

2013-01-02 Thread Ivan Popivanov
Hello, I have been struggling with this for a while, tried a few things, but no clean solution so far. Here is an example from the documentation for geom_line: == # Summarise number of movie ratings by year of movie mry - do.call(rbind, by(movies,

Re: [R] Need help with self-defined function to perform nonlinear regression and get prediction interval

2013-01-02 Thread Gabor Grothendieck
On Wed, Jan 2, 2013 at 1:23 PM, tn85 n...@isis.georgetown.edu wrote: Dear All, I was trying to call a self-defined function that performs nonlinear regression and gets the corresponding prediction upper limit using nls2 package. However, weird thing happened. When I called the function in the

Re: [R] Need help with self-defined function to perform nonlinear regression and get prediction interval

2013-01-02 Thread Tianchan Niu
Thank you Gabor for your quick response, but it didn't solve the issue, I still got the same error message when calling the function. BTW, is there any other way to get the prediction interval of nonlinear regression than using nls2 package? If yes, I might be able to avoid the possible hidden

[R] follow up on teaching R to high school students

2013-01-02 Thread Christopher W. Ryan
Some of you may recall that a few months ago I solicited advice and opinions on both R-help and R-sig-teaching about an introduction to R workshop I intended to present to a class of high school students enrolled in a 3-year longitudinal science research class. Much lively discussion ensued.

[R] modify functions in imported namespace in a new package

2013-01-02 Thread heyi xiao
Hello all, I am developing an R package. My package uses several classes and functions from another package (package A). Normally, I could just specify package A as imports or depends in my DESCPRITION and NAMESPACE files. One function I use is F, which calls a bunch of other functions including G

Re: [R] Read many cvs files

2013-01-02 Thread Yuan, Rebecca
I know that R can read cvs file, but could R read excel files? For example, in the workbook, I have 3 sheets. How could I read for those three sheets? Thanks, Rebecca -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jim

[R] suggestions about import SAS results to R.

2013-01-02 Thread Yuan, Rebecca
Hello all, I have got some data in SAS, and I export it to one excel workbook with multiple sheets, for example, each sheet has the sales information for each state. Then I need to use R to do plotting, analysis on those sales data, where I need to load the data from excel to R. When I read

Re: [R] loop correction needed

2013-01-02 Thread arun
HI, Assuming the structure is similar to this: set.seed(15) list1-lapply(c(60,120),function(i) as.data.frame(matrix(sample(1:100,240,replace=TRUE),nrow=i))) # with 2 list elements  lapply(list1,function(x) x[-c(32,64,96,128,160,192),]) A.K. - Original Message - From: eliza botto

[R] rbind: inconsistent behaviour with empty data frames?

2013-01-02 Thread Dmitrii I.
The rbind on empty and nonempty data frames behaves inconsistently. I am not sure if by design. In the first example, first row is deleted, which may or may not be on purpose: df1 - data.frame() df2 - data.frame(foo=c(1, 2), bar=c(a, b)) rbind(df1, df2) foo bar 2 2 b Now if we

Re: [R] suggestions about import SAS results to R.

2013-01-02 Thread David Winsemius
On Jan 2, 2013, at 12:37 PM, Yuan, Rebecca wrote: Hello all, I have got some data in SAS, and I export it to one excel workbook with multiple sheets, for example, each sheet has the sales information for each state. Then I need to use R to do plotting, analysis on those sales data,

Re: [R] suggestions about import SAS results to R.

2013-01-02 Thread Suzen, Mehmet
On Jan 2, 2013, at 12:37 PM, Yuan, Rebecca wrote: I am wondering if there is an efficient way to read SAS data directly in R, or what would be a better connection between SAS and R if I need to use R to deal with data achieved from SAS? You may try foreign and SASxport packages:

Re: [R] rbind: inconsistent behaviour with empty data frames?

2013-01-02 Thread David L Carlson
What version of R are you using? I cannot replicate your results with R 2.15.2: df1 - data.frame() df2 - data.frame(foo=c(1, 2), bar=c(a, b)) rbind(df1, df2) foo bar 1 1 a 2 2 b df1 - data.frame(matrix(0, 0, 2)) names(df1) - names(df2) rbind(df1, df2) foo bar 1 1 a 2 2

[R] sm prediction

2013-01-02 Thread Tom Jones
How can I predict new data with a regression by the sm package. predict() does not work for the sm results and I can't find any newdata option. [[alternative HTML version deleted]] __

Re: [R] suggestions about import SAS results to R.

2013-01-02 Thread Yuan, Rebecca
Hello all, Thanks for the suggestions. I tried to import data from sas to R using foreign package. In the first step, I tried to use read.ssd() to convert the sas file sales.sas7bdat to SAS Transport formats. But I got an error message as

[R] list of matrices

2013-01-02 Thread eliza botto
dear useRs, i have a list containing 16 matrices. i want to calculate the column mean of each of them. i tried sr - lapply(s,function(x) colMeans(x, na.rm=TRUE)) but i am getting the following error Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric can it be done in any other way? and

Re: [R] suggestions about import SAS results to R.

2013-01-02 Thread Ista Zahn
Hi Rebecca, I've had success with the sas7bdat package ( http://cran.r-project.org/web/packages/sas7bdat/ ) Best, Ista On Wed, Jan 2, 2013 at 5:15 PM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello all, Thanks for the suggestions. I tried to import data from sas to R using

Re: [R] list of matrices

2013-01-02 Thread arun
Hi, Check this link http://tolstoy.newcastle.edu.au/R/help/05/04/1765.html set.seed(15) list1-lapply(1:3,function(i) matrix(sample(1:10,6,replace=TRUE),ncol=i) ) lapply(list1,function(x) colMeans(x,na.rm=TRUE)) [[1]] #[1] 6.67 #[[2]] #[1] 6.33 6.00 ## #[[3]] #[1] 7.0 9.0 7.5 A.K.

Re: [R] suggestions about import SAS results to R.

2013-01-02 Thread Yuan, Rebecca
Hello Ista, Thanks for mention this package, however, it will not support big file, where I got the error message: -- Error in read.sas7bdat(C:/Documents and Settings/test.sas7bdat) : big endian files are not supported -- Cheers, Rebecca

Re: [R] list of matrices

2013-01-02 Thread Bert Gunter
I fail to understand the purpose of your post. The error message seems clear enough: either your matrices are not all numeric or you may have data frames among them with non-numeric columns. Have you checked either or both? ?is.matrix ?is.numeric as in lapply(s,is.matrix(x) is.numeric(x))

Re: [R] suggestions about import SAS results to R.

2013-01-02 Thread David Winsemius
On Jan 2, 2013, at 2:44 PM, Yuan, Rebecca wrote: Hello Ista, Thanks for mention this package, however, it will not support big file, where I got the error message: -- Error in read.sas7bdat(C:/Documents and Settings/test.sas7bdat) : big endian files are not

Re: [R] SIGN.test

2013-01-02 Thread Rolf Turner
On 03/01/13 07:45, solafah bh wrote: Hello I used SIGN.test function in R 2.12.2 to apply one sample sign test and it is worked well ,but I want to put statistic in a variable and I could not get this value, I used : x=rnorm(100) t=SIGN.test(x,md=0,alt=less) t$rval[1]$statistic the last

Re: [R] SIGN.test

2013-01-02 Thread William Dunlap
There is a SIGN.test in package:BSDA and it does not work as documented - it returns a matrix of confidence intervals in some situations and the documented htest object in others. E.g., x - log2(1:32) str(SIGN.test(x, md=1, alt=less, conf.level=1)) List of 8 $ statistic : Named int

Re: [R] Package check using --as-cran

2013-01-02 Thread Marc Girondot
Le 02/01/13 17:38, Uwe Ligges a écrit : On 02.01.2013 17:28, Marc Girondot wrote: Le 02/01/13 16:03, Uwe Ligges a écrit : On 02.01.2013 11:58, Marc Girondot wrote: I use R 2.15.2 on MacosX 10.8.2 I have a problem checking for a package that I want to submit in CRAN. When I check like

Re: [R] list of matrices

2013-01-02 Thread arun
HI Elisa, The data that you sent to me is a matrix, (not the list containing 16 matrices).  source(Elizanew.txt)  is.matrix(dat1) #[1] TRUE dim(dat1) #[1] 558  12 dat1-na.omit(dat1)  nrow(dat1) #[1] 508 colMeans(dat1)  #[1]   970.1942   892.5579   893.3180  1629.0733  5692.8488 12529.8313  

[R] interpreting results of regression using ordinal predictors in R

2013-01-02 Thread Ranjan Maitra
Dear friends, Being very new to this, I was wondering if I could get some pointers and guidance to interpreting the results of performing a linear regression with ordinal predictors in R. Here is a simple, toy example: y - c(-0.11, -0.49, -1.10, 0.08, 0.31, -1.21, -0.05, -0.40, -0.01,

Re: [R] interpreting results of regression using ordinal predictors in R

2013-01-02 Thread David Winsemius
On Jan 2, 2013, at 9:22 PM, Ranjan Maitra wrote: Dear friends, Being very new to this, I was wondering if I could get some pointers and guidance to interpreting the results of performing a linear regression with ordinal predictors in R. Here is a simple, toy example: y - c(-0.11, -0.49,

Re: [R] interpreting results of regression using ordinal predictors in R

2013-01-02 Thread Bert Gunter
Below ... -- Bert On Wed, Jan 2, 2013 at 9:54 PM, David Winsemius dwinsem...@comcast.netwrote: ... Search on orthogonal polynomials. Yes, but this does not explain what these have to do with ordered factors and contrasts in a linear model. That information is contained in An Introduction to

Re: [R] interpreting results of regression using ordinal predictors in R

2013-01-02 Thread David Winsemius
On Jan 2, 2013, at 10:09 PM, Bert Gunter wrote: Below ... -- Bert On Wed, Jan 2, 2013 at 9:54 PM, David Winsemius dwinsem...@comcast.net wrote: ... Search on orthogonal polynomials. Yes, but this does not explain what these have to do with ordered factors and contrasts in a linear

[R] Sas by function in R

2013-01-02 Thread catalin roibu
Hello, It's an alternative to use SAS by function in R? I want to plot d histograms by plot.from example bellow: Thank you! plot d 1 1 16.3 2 1 25.0 3 1 57.8 4 1 17.0 5 2 10.8 13 2 96.4 17 3 76.0 18 3 32.0 19 3 11.0 20 3 11.0 24 3