[R] Factor levels

2007-08-28 Thread Sébastien
Dear R-users, I have found this not-so-recent post in the archives - http://tolstoy.newcastle.edu.au/R/devel/00a/0291.html - while I was looking for a particular way to reorder factor levels. The question addressed by the author was to know if the read.table function could be modified to

Re: [R] Factor levels

2007-08-28 Thread Gabor Grothendieck
You can create your own class and pass that to read table. In the example below Fld2 is read in with factor levels C, A, B in that order. library(methods) setClass(my.levels) setAs(character, my.levels, function(from) factor(from, levels = c(C, A, B))) ### test ### Input - Fld1 Fld2 10 A

Re: [R] Factor levels

2007-08-28 Thread Sébastien
Thanks Gabor, I have two questions: 1- Is there any difference between your code and the following one, with regards to Fld2 ? ### test ### Input - Fld1 Fld2 10 A 20 B 30 C 40 A DF - read.table(textConnection(Input), header = TRUE) DF$Fld2-factor(DF$Fld2,levels= c(C, A, B))) 2- do you see

Re: [R] Factor levels

2007-08-28 Thread Gabor Grothendieck
Its not clear from your description what you want. Could you be a bit more specific including an example. On 8/28/07, Sébastien [EMAIL PROTECTED] wrote: Thanks Gabor, I have two questions: 1- Is there any difference between your code and the following one, with regards to Fld2 ? ### test ###

Re: [R] Factor levels

2007-08-28 Thread Sébastien
Ok, I cannot send to you one of my dataset since they are confidential. But I can produce a dummy mini dataset to illustrate my question. Let's say I have a csv file with 3 columns and 20 rows which content is reproduced by the following line. mydata-data.frame(a=1:20,

Re: [R] Factor levels

2007-08-28 Thread Gabor Grothendieck
Its the same principle. Just change the function to be suitable. This one arranges the levels according to the input: library(methods) setClass(my.factor) setAs(character, my.factor, function(from) factor(from, levels = unique(from))) Input - a b c 1 1 176 w 2 2 141 k 3 3 172 r 4 4

Re: [R] Factor levels

2007-08-28 Thread Peter Alspach
d q f Peter Alspach -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sébastien Sent: Wednesday, 29 August 2007 9:00 a.m. To: Gabor Grothendieck Cc: R-help Subject: Re: [R] Factor levels Ok, I cannot send to you one of my dataset since

Re: [R] Factor levels

2007-08-28 Thread Sébastien
. To: Gabor Grothendieck Cc: R-help Subject: Re: [R] Factor levels Ok, I cannot send to you one of my dataset since they are confidential. But I can produce a dummy mini dataset to illustrate my question. Let's say I have a csv file with 3 columns and 20 rows which content is reproduced

Re: [R] factor analysis

2007-06-06 Thread Spencer Graves
I haven't seen an answer to this post, so I thought I would try to generate a response. Regarding your first question (Can i use this factor analysis somehow despite the poor cumulative variance of the first three factors ?), I would ask, for what purpose? And, What are the

[R] factor analysis

2007-06-03 Thread bunny , lautloscrew.com
Hi there, i´ve trouble understanding the factanal output of R. i am running a a FA on a dataset with 10 variables. i plotted eigenvalues to finde out how many factors to try. i think the elbow is @ 3 factors. here are my eigenvalues: 2.6372766 1.5137754 1.0188919 0.8986154 0.8327583 0.7187473

Re: [R] Factor analysis

2007-06-01 Thread ronggui
I wrote some rough functions for principal factor, principal-components factor, and iterated principal factor analysis. I think they are workable, the same results as stata can be retained. In addition, functions for gls and uls factor analysis is in progress, which is based on the algorithms of

[R] Factor analysis

2007-05-31 Thread Sigbert Klinke
Hi, is there any other routine for factor analysis in R then factanal? Basically I'am interested in another extraction method then the maximum likelihood method and looking for unweighted least squares. Thanks in advance Sigbert Klinke __

[R] Factor function: odd behavior when labels argument contains duplicates?

2007-05-30 Thread Steen Ladelund
Hi all. I think it would be nice to be able to combine levels of a factor on creation a la x - rep(0:5,5) y - factor(x,levels=0:5,labels=c('1','1',2:5)) ## (1) y [1] 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 Levels: 1 1 2 3 4 5 I thougt this would (should?) create a

Re: [R] Factor function: odd behavior when labels argument containsduplicates?

2007-05-30 Thread Bill.Venables
/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steen Ladelund Sent: Wednesday, 30 May 2007 6:27 PM To: r-help@stat.math.ethz.ch Subject: [R] Factor function: odd behavior when labels argument containsduplicates? Hi all. I think it would be nice to be able

[R] factor analysis and pattern matrix

2007-03-05 Thread Steven Lacey
Hi, In a discussion of factor analysis in Using Multivariate Statistics by Tabachnick and Fidell, two matrices are singled out as important for interpreting an exploratory factor analysis (EFA) with an oblique promax rotation. One is the structure matrix. The structure matrix contains the

[R] factor analysis and pattern matrix

2007-03-04 Thread Steven Lacey
Hi, In a discussion of factor analysis in Using Multivariate Statistics by Tabachnick and Fidell, two matrices are singled out as important for interpreting an exploratory factor analysis (EFA) with an oblique promax rotation. One is the structure matrix. The structure matrix contains the

Re: [R] factor documentation issue

2007-02-28 Thread Heinz Tuechler
At 09:41 28.02.2007 +1030, Geoff Russell wrote: There is a warning in the documentation for ?factor (R version 2.3.0) as follows: The interpretation of a factor depends on both the codes and the 'levels' attribute. Be careful only to compare factors with the same set of levels (in the same

[R] factor documentation issue

2007-02-27 Thread Geoff Russell
There is a warning in the documentation for ?factor (R version 2.3.0) as follows: The interpretation of a factor depends on both the codes and the 'levels' attribute. Be careful only to compare factors with the same set of levels (in the same order). In particular, 'as.numeric' applied

Re: [R] factor documentation issue

2007-02-27 Thread Peter Dalgaard
Geoff Russell wrote: There is a warning in the documentation for ?factor (R version 2.3.0) as follows: The interpretation of a factor depends on both the codes and the 'levels' attribute. Be careful only to compare factors with the same set of levels (in the same order). In

Re: [R] factor()

2007-01-22 Thread talepanda
TeamInfo TEAMNAME LEVEL WORKTIME BONUS 1 batch sunan B 135 9,818 2 batch Chenqi E 121 6,050 3 batch jiangxu F 97 4,189 4 online zhouxi F 63 2,720 5 online chenhe H 36 1,064 ## try: factor(TeamInfo$TEAM) [1] batch batch batch

[R] factor analysis using Principal Component Method

2006-11-28 Thread Mario Alfonso Morales Rivera
Is there any R function to perform factor analysis using Principal Component Method? why factanal() method is always mle ? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] factor analysis using Principal Component Method

2006-11-28 Thread Patrick Burns
The 'factor.model.stat' function that is available in the public domain area of the Burns Statistics website may or may not satisfy your needs. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Mario Alfonso

Re: [R] factor analysis using Principal Component Method

2006-11-28 Thread Peter Dalgaard
Mario Alfonso Morales Rivera wrote: Is there any R function to perform factor analysis using Principal Component Method? why factanal() method is always mle ? Because PCM is not factor analysis (the two methods fit different models) and R didn't want to take part in the mislabeling

Re: [R] factor levels with umlauts

2006-10-10 Thread Prof Brian Ripley
On Fri, 6 Oct 2006, Christian Bieli wrote: Hi all I have to generate some test data for import in an sql database. The database is meant for web-based data entry in a study taking place in a german speaking region, so factor levels of the variables include umlauts. The variables in the

Re: [R] factor levels with umlauts

2006-10-10 Thread Christian Bieli
Thanks for your answer. I went round the problem by directly connect to the sql-database instead of generating a .csv file and then upload it. This works perfectly with the RODBC package and is much more suitable, too. Kind regards Christian Prof Brian Ripley schrieb: On Fri, 6 Oct 2006,

[R] factor levels with umlauts

2006-10-06 Thread Christian Bieli
Hi all I have to generate some test data for import in an sql database. The database is meant for web-based data entry in a study taking place in a german speaking region, so factor levels of the variables include umlauts. The variables in the dataframe t.muster are generated e.g. like this:

Re: [R] factor to numeric (no subject)

2006-09-12 Thread Petr Pikal
Hi all culumns which are used for discrimination (in your case 3) are factor. If you want to change them to numeric you has to use as.numeric(as.character(x[,3])) I believe it is in FAQ. HTH Petr Please use sensible subject. On 12 Sep 2006 at 14:49, Anders Eklund wrote: Date sent:

[R] factor analysis - discrepancy in results from R vs. Stata

2006-05-19 Thread Ricardo Pietrobon
Hi, I found a discrepancy between results in R and Stata for a factor analysis with a promax rotation. For Stata: . *rotate, factor(2) promax* (promax rotation) Rotated Factor Loadings Variable | 1 2Uniqueness

Re: [R] factor analysis - discrepancy in results from R vs. Stata

2006-05-19 Thread Prof Brian Ripley
I don't believe promax is uniquely defined. Not only are there differences in the criterion (R allows a choice), it is an optimization problem with multiple local optima. In fact the same is true of factanal, and the first thing to check would be to see if the same FA solution has been found.

[R] factor to real - best way to convert

2006-05-03 Thread Knut Krueger
I have got factor from read.xls: is(factor_value) [1] factor oldClass [288] -0.32 0.180.180.18-0.32 0.180.68 [295] 0.680.18 43 Levels: -0.05 -0.13 -0.15 -0.18 -0.20 -0.26 ... 1.33 If I am using the funciton as.real(factor_value) I get [271] 17

Re: [R] factor to real - best way to convert

2006-05-03 Thread Gabor Grothendieck
You can use as.is = TRUE arg to read.xls to get character data rather than factors. On 5/3/06, Knut Krueger [EMAIL PROTECTED] wrote: I have got factor from read.xls: is(factor_value) [1] factor oldClass [288] -0.32 0.180.180.18-0.32 0.180.68 [295] 0.680.18

[R] factor levels on import

2006-04-22 Thread Stephen C. Upton
I have a data frame that I plan on importing from a file (there are other columns of numeric data): xy x y 1 1 1 2 1 1 3 1 1 4 1 1 5 2 2 6 2 2 7 2 2 8 2 2 where x is a column of factors, and y is a column of factors, that have different levels, e.g., x [1] low low low low hi hi hi hi

Re: [R] factor levels on import

2006-04-22 Thread Uwe Ligges
Stephen C. Upton wrote: I have a data frame that I plan on importing from a file (there are other columns of numeric data): xy x y 1 1 1 2 1 1 3 1 1 4 1 1 5 2 2 6 2 2 7 2 2 8 2 2 where x is a column of factors, and y is a column of factors, that have different levels,

[R] factor analysis backwards

2006-04-12 Thread Stefan Premke
Hello! How can I do a factor analysis backwards to get an arbitrary covarianz matrix out of an arbitrary number of generated random variables that have a correlation near zero. Or the same question shorter: How to generate random variables that have a spezial correlation pattern. I would like

Re: [R] factor analysis backwards

2006-04-12 Thread Berton Gunter
more, as described in the posting guide (have you read it?) -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Premke Sent: Wednesday, April 12, 2006 6:52 AM To: r-help@stat.math.ethz.ch Subject: [R] factor analysis backwards Hello! How

Re: [R] factor analysis backwards

2006-04-12 Thread Chuck Cleland
Stefan Premke wrote: Hello! How can I do a factor analysis backwards to get an arbitrary covarianz matrix out of an arbitrary number of generated random variables that have a correlation near zero. Or the same question shorter: How to generate random variables that have a spezial

[R] Factor Analysis

2006-01-27 Thread Krish Krishnan
I am very new to factor analysis as well as R. I am trying to run a factor analysis on the residual returns on common stock (residual to some model) and trying to determine if there are any strong factors remaining. After running factanal, I can obtain the factor loadings but how do I get

Re: [R] Factor Analysis

2006-01-27 Thread Prof Brian Ripley
On Fri, 27 Jan 2006, Krish Krishnan wrote: I am very new to factor analysis as well as R. I am trying to run a factor analysis on the residual returns on common stock (residual to some model) and trying to determine if there are any strong factors remaining. After running factanal, I can

[R] factor or not factor that is a question

2006-01-19 Thread Petr Pikal
Dear all I encountered strange problem with split factor. I tried to use boxplot(split(, factor)) but I got an error message split(test$asar,kvartaly) Error in split(x, f) : second argument must be a factor str(kvartaly) Factor w/ 8 levels 1Q.04,2Q.04,..: 1 1 1 1 1 1 1 1 1 1 ...

Re: [R] factor : how does it work ?

2005-10-07 Thread Petr Pikal
: Date sent: Thu, 6 Oct 2005 17:08:17 +0200 From: Florence Combes [EMAIL PROTECTED] To: Duncan Murdoch [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject:Re: [R] factor : how does it work ? Send reply to: Florence Combes

[R] factor : how does it work ?

2005-10-06 Thread Florence Combes
Dear all, I try for long to understand exactly what is the factor type and especially how it works, but it seems too difficult for me I read paragraphs about it, and I understand quite well what it is (I think) but I still can't figure how to deal with. Especially these 2 mysteries (for me) :

Re: [R] factor : how does it work ?

2005-10-06 Thread Duncan Murdoch
On 10/6/2005 9:14 AM, Florence Combes wrote: Dear all, I try for long to understand exactly what is the factor type and especially how it works, but it seems too difficult for me I read paragraphs about it, and I understand quite well what it is (I think) but I still can't figure how to

Re: [R] factor : how does it work ?

2005-10-06 Thread Florence Combes
2d I can't manage to deal with factors, so when I have some, I transform them in vectors (with levels()), but I think I miss the power and utility of the factor type ? levels() is not the conversion you want. in fact I use 'as.numeric(levels(f))[f]' (from the ?factor

Re: [R] factor : how does it work ?

2005-10-06 Thread Duncan Murdoch
On 10/6/2005 10:20 AM, Florence Combes wrote: 2d I can't manage to deal with factors, so when I have some, I transform them in vectors (with levels()), but I think I miss the power and utility of the factor type ? levels() is not the conversion you want. in fact I use

Re: [R] factor : how does it work ?

2005-10-06 Thread Florence Combes
a last question, and thanks a million for your patience and your explanations ... I tried with a df called merged and a column named Pcc_0h_A (which is numeric values): length(as.vector(merged$Pcc_0h_A)) [1] 12202 as.numeric(as.vector(merged$Pcc_0h_A)[1:10]) [1] 12.276 11.958 14.098 13.843

Re: [R] factor : how does it work ?

2005-10-06 Thread Duncan Murdoch
On 10/6/2005 10:50 AM, Florence Combes wrote: a last question, and thanks a million for your patience and your explanations ... I tried with a df called merged and a column named Pcc_0h_A (which is numeric values): length(as.vector(merged$Pcc_0h_A)) [1] 12202

Re: [R] factor : how does it work ?

2005-10-06 Thread Florence Combes
head(merged) ID Name Pcc_0h_A Pcc_0h_swapped_A 3302 301495 Q0010_01 |Q0010||Hypothetical ORF 12.276 11.716 6943 309175 Q0010_01 |Q0010||Hypothetical ORF 11.958 11.271 14065 298935 Q0017_01 |Q0017||Hypothetical ORF 14.098 13.122 6420 306615 Q0017_01 |Q0017||Hypothetical ORF 13.843 13.061 5066

Re: [R] factor as seq() in for loop

2005-09-21 Thread Spencer Graves
Does the follow help? aFactor - factor(rep(letters[1:3], 1:3)) aFactor [1] a b b c c c Levels: a b c for(af in levels(aFactor)){ + print(sum(aFactor==af)) + } [1] 1 [1] 2 [1] 3 spencer graves Tord Snall wrote: Dear all, I would like to use the values in

Re: [R] factor as seq() in for loop

2005-09-21 Thread Tord Snall
Dear Spencer, Does the follow help? Yes, as did the earlier replies. Thanks! Tord aFactor - factor(rep(letters[1:3], 1:3)) aFactor [1] a b b c c c Levels: a b c for(af in levels(aFactor)){ + print(sum(aFactor==af)) + } [1] 1 [1] 2 [1] 3 spencer graves

[R] factor as seq() in for loop

2005-09-19 Thread Tord Snall
Dear all, I would like to use the values in vegaggr.BLMCMR02$colony str(vegaggr.BLMCMR02) `data.frame': 1678 obs. of 3 variables: $ vegtype : Factor w/ 27 levels 2010,2020,..: 3 4 5 19 4 5 19 5 $ colony: Factor w/ 406 levels 0,1,10,100,..: 1 1 1 1 2 2 2 $ Totvegproparea: num

Re: [R] factor as seq() in for loop

2005-09-19 Thread Peter Dalgaard
Tord Snall [EMAIL PROTECTED] writes: Dear all, I would like to use the values in vegaggr.BLMCMR02$colony str(vegaggr.BLMCMR02) `data.frame': 1678 obs. of 3 variables: $ vegtype : Factor w/ 27 levels 2010,2020,..: 3 4 5 19 4 5 19 5 $ colony: Factor w/ 406 levels

Re: [R] factor as seq() in for loop

2005-09-19 Thread Gabor Grothendieck
On 9/19/05, Tord Snall [EMAIL PROTECTED] wrote: Dear all, I would like to use the values in vegaggr.BLMCMR02$colony str(vegaggr.BLMCMR02) `data.frame': 1678 obs. of 3 variables: $ vegtype : Factor w/ 27 levels 2010,2020,..: 3 4 5 19 4 5 19 5 $ colony: Factor w/ 406 levels

[R] factor to character

2005-06-28 Thread Omar Lakkis
Using RODBC, when I select from a table strings (chars and varchars) come as factors. What is the best way, speed wise, to convert these columns back to strings (perhaps using as.character). __ R-help@stat.math.ethz.ch mailing list

Re: [R] factor to character

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Omar Lakkis wrote: Using RODBC, when I select from a table strings (chars and varchars) come as factors. What is the best way, speed wise, to convert these columns back to strings (perhaps using as.character). FAQ Q7.10, replacing numeric by character. You do have

[R] factor vector manipulation

2005-06-03 Thread Weiwei Shi
Hi, I have one question on factor vector. I have 3 factor vectors: a-factor(c(1, 2, 3)) b-factor(c(a, b, c)) c-factor(c(b, a, c)) what I want is like: c x 1 b 2 2 a 1 3 c 3 which means, I use b as keys and vector a as values and I find values for c. I used the following codes: x-c()

Re: [R] factor vector manipulation

2005-06-03 Thread Gabor Grothendieck
On 6/3/05, Weiwei Shi [EMAIL PROTECTED] wrote: Hi, I have one question on factor vector. I have 3 factor vectors: a-factor(c(1, 2, 3)) b-factor(c(a, b, c)) c-factor(c(b, a, c)) what I want is like: c x 1 b 2 2 a 1 3 c 3 which means, I use b as keys and vector a as values and I

Re: [R] Factor Analysis functions...

2005-04-22 Thread Pierre BADY
hi all, In the library ‘ade4’, there are two eigenanalysis which enable the ordination of the categorical variables. 1- Multiple Correspondence Analysis (MCA, Tenenhaus Young 1985) performs the multiple correspondence analysis of a factor table (see the function ‘dudi.acm’). this function is

[R] Factor Analysis functions...

2005-04-21 Thread Chris Bergstresser
Hi all -- I'm running a Factor Analysis on my dataset, and I've located the factanal() and princomp() methods. I don't want to do a PCA, so it looks like I should use factanal(), but factanal() requires specifying the number of factors you expect from the analysis. Are there any

Re: [R] Factor Analysis Biplot

2005-04-15 Thread Jari Oksanen
On Fri, 2005-04-15 at 12:49 +1200, Brett Stansfield wrote: Dear R Dear S, When I go to do the biplot biplot(eurofood.fa$scores, eurofood$loadings) Error in 1:p : NA/NaN argument Potential sources of error (guessing: no sufficient detail given in the message): - you ask scores from

[R] Factor Analysis Biplot

2005-04-14 Thread Brett Stansfield
Dear R help I am having difficulty doing a biplot of the first two factors of a factor analysis. I presume it is because the values in factor 2 for Milk and NUTS are not displayed in the component loadings. Loadings: Factor1 Factor2 RedMeat0.561 -0.112 WhiteMeat 0.593 -0.432

[R] Factor Analysis Biplot

2005-04-14 Thread Brett Stansfield
Dear R When I go to do the biplot biplot(eurofood.fa$scores, eurofood$loadings) Error in 1:p : NA/NaN argument I think this is because the component loadings don't show values for some variables Loadings: Factor1 Factor2 RedMeat0.561 -0.112 WhiteMeat 0.593 -0.432 Eggs

[R] factor to numeric in data.frame

2005-04-02 Thread Heinz Tuechler
Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on them. I read the warning concerning as.numeric or unclass, but in my case this makes sense, because

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Gabor Grothendieck
Try this: data.matrix(df.f12) On Apr 2, 2005 6:01 AM, Heinz Tuechler [EMAIL PROTECTED] wrote: Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Prof Brian Ripley
On Sat, 2 Apr 2005, Heinz Tuechler wrote: Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on them. I read the warning concerning as.numeric or unclass,

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Heinz Tuechler
At 07:15 02.04.2005 -0500, Gabor Grothendieck wrote: Try this: data.matrix(df.f12) Perfect! This is exactly what I needed. Many thanks, Heinz Tüchler On Apr 2, 2005 6:01 AM, Heinz Tuechler [EMAIL PROTECTED] wrote: Dear All, Assume I have a data.frame that contains also factors and I would

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Heinz Tuechler
At 14:26 02.04.2005 +0100, Prof Brian Ripley wrote: On Sat, 2 Apr 2005, Heinz Tuechler wrote: Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on

[R] Factor level coloring in trellis plot

2005-02-17 Thread T.A.Wassenaar
Hi :) Was just wondering whether someone could help me with adjustments to trellis plots (parallel). I've got two way multivariate data. I want to make parallel plots for one of the factors, and want to color the lines according to the other factor. The first thing I manage, but with the

Re: [R] Factor level coloring in trellis plot

2005-02-17 Thread Deepayan Sarkar
On Thursday 17 February 2005 04:39, T.A.Wassenaar wrote: Hi :) Was just wondering whether someone could help me with adjustments to trellis plots (parallel). I've got two way multivariate data. I want to make parallel plots for one of the factors, and want to color the lines according to

[R] Factor analysis with dichotomous variables

2004-12-17 Thread Tom Denson
Hello, I would like to conduct an exploratory factor analysis with dichotomous data. Do any R routines exist for this purpose? I recall reading something about methods with tetrachoric correlations. Any help would be appreciated. Best, Tom Denson Department of Psychology University of Southern

RE: [R] Factor analysis with dichotomous variables

2004-12-17 Thread Doran, Harold
:31 PM To: [EMAIL PROTECTED] Subject: [R] Factor analysis with dichotomous variables Hello, I would like to conduct an exploratory factor analysis with dichotomous data. Do any R routines exist for this purpose? I recall reading something about methods with tetrachoric correlations. Any help would

Re: [R] Factor analysis with dichotomous variables

2004-12-17 Thread Chris Lawrence
] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Denson Sent: Friday, December 17, 2004 12:31 PM To: [EMAIL PROTECTED] Subject: [R] Factor analysis with dichotomous variables Hello, I would like to conduct an exploratory factor analysis with dichotomous data. Do any R routines exist for this purpose

[R] factor matrix

2004-12-02 Thread Adrian Baddeley
Sorry if this is a FAQ. Is there a good reason why a factor has to be a one-dimensional vector and cannot be a matrix? I want to construct matrices of categorical values. Vain attempts like matrix(factor(c(T,F,F,T), 2,2) yield a matrix of character strings representing the factor levels,

RE: [R] factor matrix

2004-12-02 Thread Mulholland, Tom
I'm not sure, but is this what you want matrix(as.numeric(factor(c(T,F,F,T))), 2,2) Tom Mulholland -Original Message- From: Adrian Baddeley [mailto:[EMAIL PROTECTED] Sent: Friday, 3 December 2004 1:45 PM To: [EMAIL PROTECTED] Subject: [R] factor matrix Sorry if this is a FAQ

RE: [R] factor matrix

2004-12-02 Thread Adrian Baddeley
matrix(as.numeric(factor(c(T,F,F,T))), 2,2) No, this produces a matrix with numeric values, not categorical values. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

RE: [R] factor matrix

2004-12-02 Thread Mulholland, Tom
] TRUE FALSE FALSE TRUE Levels: FALSE TRUE -Original Message- From: Adrian Baddeley [mailto:[EMAIL PROTECTED] Sent: Friday, 3 December 2004 2:44 PM To: Mulholland, Tom Cc: [EMAIL PROTECTED] Subject: RE: [R] factor matrix matrix(as.numeric(factor(c(T,F,F,T))), 2,2

RE: [R] factor matrix

2004-12-02 Thread Petr Pikal
__ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] factor always have type integer

2004-09-09 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Erich Neuwirth wrote: The function I need is valtype-function(x) typeof(ifelse(is.factor(x),levels(x),x)) It is easy enough to write. Are there any other special cases where the values and the storage mode differ? All classed objects are more than the internal

Re: [R] factor always have type integer

2004-09-09 Thread Prof Brian Ripley
On Thu, 9 Sep 2004, Erich Neuwirth wrote: The simple answer to my problem (are the values of a vector numeric or not) is is.numeric, and that is enough for what I need right now. But this way I do not get an answer discriminating between integers and and doubles. What is the canonical way of

[R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
typeof applied to a factor always seems to return integer, independently of the type of the levels. This has a strange side effect. When a variable is imported into a data frame, its type changes. character variables automatically are converted to factors when imported into data frames. Here is an

RE: [R] factor always have type integer

2004-09-08 Thread Liaw, Andy
?data.frame says: Details: A data frame is a list of variables of the same length with unique row names, given class 'data.frame'. 'data.frame' converts each of its arguments to a data frame by calling 'as.data.frame(optional=TRUE)'. As that is a generic function,

Re: [R] factor always have type integer

2004-09-08 Thread Roger D. Peng
In some cases it makes sense to store character variables as factors (integers with labels) since this can take up much less memory. If you really want to store `v2' as character, just do data.frame(v1, I(v2)) -roger Erich Neuwirth wrote: typeof applied to a factor always seems to return

Re: [R] factor always have type integer

2004-09-08 Thread Prof Brian Ripley
On Wed, 8 Sep 2004, Erich Neuwirth wrote: typeof applied to a factor always seems to return integer, independently of the type of the levels. typeof is telling you the internal structure. From ?factor 'factor' returns an object of class 'factor' which has a set of integer codes the

Re: [R] factor always have type integer

2004-09-08 Thread Erich Neuwirth
The function I need is valtype-function(x) typeof(ifelse(is.factor(x),levels(x),x)) It is easy enough to write. Are there any other special cases where the values and the storage mode differ? The background for all this is that I am transferring data from R to Excel with VBA and I have to

RE: [R] factor always have type integer

2004-09-08 Thread Berton Gunter
Therefore, I would like to know if there are other types of variables (besides factors) which give a misunderstandable answer about the type of their values when asked typeof. Your question is a bit combative, don't you think? R performs as documented, so I think your characterization is

Re: [R] factor always have type integer

2004-09-08 Thread Gabor Grothendieck
Note that I(v2) stores v2 as type character but not as class character. For example, R DF - data.frame(x = c(a, b), y = I(c(a, b)), z = I(c(a, b))) R class(DF$z) - character R sapply(DF, typeof) # y and z do have the same type x y z integer character character

[R] factor analysis package

2004-06-15 Thread Katja Loytynoja
Hello everyone, is there a package/packages for factor analysis, particularly PCA? thanks, Katja Katja Löytynoja Taitoniekantie 9 A 218 40 740 Jyväskylä Finland tel.+35814 608058 cell.+35850 336 0174 [EMAIL PROTECTED] __ [EMAIL PROTECTED]

Re: [R] factor analysis package

2004-06-15 Thread Peter Dalgaard
Katja Loytynoja [EMAIL PROTECTED] writes: Hello everyone, is there a package/packages for factor analysis, particularly PCA? help.search(factor analysis) help.search(principal components) (Whether PCA qualifies as factor analysis is debatable, though...) -- O__ Peter Dalgaard

Re: [R] factor analysis package

2004-06-15 Thread Prof Brian Ripley
R comes with support for factor analysis and PCA (*not* the same thing) in package stats which is normally loaded. Try help.search(factor analysis) help.search(principal components) On Tue, 15 Jun 2004, Katja Loytynoja wrote: Hello everyone, is there a package/packages for factor analysis,

[R] factor - numeric

2004-06-02 Thread Mikkel Grum
Hi, I'm extracting data from a database with values for different observation types in the same variable (another variable deifnes the observation type). Some of these observation types are factors, so R naturally classifies the entire variable as a factor. I want to select a subset and convert

Re: [R] factor - numeric

2004-06-02 Thread Spencer Graves
Have you tried as.numeric(as.character(rsm2$Value))? The construct as.numeric(rsm2$Value) returns the NUMERIC CODES for the different levels; as.character(rsm2$Value) returns the character representation, which you can then convert to numeric. hope this helps. spencer graves

Re: [R] factor analysis

2004-05-14 Thread Andrew Criswell
Hello: The website http://ourworld.compuserve.com/homepages/jsuebersax/tetra.htm might provide you with further hints and information on implementing polychoric correlations. Further information related to your inquiry can also be found on http://www.unt.edu/rss/class/rich/5840/ In addition,

Re: [R] factor analysis

2004-05-13 Thread John Fox
Dear Allan, I assume that the categorical data are ordinal. There are methods for factor analyzing ordinal data (e.g., using polychoric correlations) and mixed ordinal and interval data, but as far as I know, these aren't implemented in R. John On Thu, 13 May 2004 18:32:11 +0200 allan clark

Re: [R] factor analysis

2004-05-13 Thread Pierre BADY
hi all, In the library ‘ade4’, there are two eigenanalysis which enable the ordination of the categorical variables. 1- Multiple Correspondence Analysis (MCA, Tenenhaus Young 1985) performs the multiple correspondence analysis of a factor table (see the function ‘dudi.acm’). 2- the “mixed

Re: [R] Factor loadings and principal component plots

2004-05-04 Thread Prof Brian Ripley
On 4 May 2004, Jari Oksanen wrote: On Tue, 2004-05-04 at 09:34, Prof Brian Ripley wrote: Yes, but princomp is the recommended way, not prcomp. But the documentation seems to recommend prcomp: For numerical accuracy, but not for flexibility. ?prcomp: The calculation is

Re: [R] Factor loadings and principal component plots

2004-05-04 Thread Jari Oksanen
On Tue, 2004-05-04 at 09:56, Prof Brian Ripley wrote: On 4 May 2004, Jari Oksanen wrote: On Tue, 2004-05-04 at 09:34, Prof Brian Ripley wrote: Yes, but princomp is the recommended way, not prcomp. But the documentation seems to recommend prcomp: For numerical accuracy, but

RE: [R] Factor loadings and principal component plots

2004-05-04 Thread antonio rodriguez
Hi Neil, -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] nombre de [EMAIL PROTECTED] Enviado el: lunes, 03 de mayo de 2004 23:22 Para: [EMAIL PROTECTED] Asunto: [R] Factor loadings and principal component plots Hi- Can anyone tell me the command(s

Re: [R] Factor loadings and principal component plots

2004-05-04 Thread Prof Brian Ripley
Well, factor loadings apply to factor analysis, not PCA, so have you confused the two? (Lots of the literature does.) On Mon, 3 May 2004 [EMAIL PROTECTED] wrote: Hi- Can anyone tell me the command(s) to produce the following plots: -Factor loadings plot for principal components -Plot of

Re: [R] Factor loadings and principal component plots

2004-05-04 Thread Jari Oksanen
On Tue, 2004-05-04 at 09:34, Prof Brian Ripley wrote: Yes, but princomp is the recommended way, not prcomp. But the documentation seems to recommend prcomp: ?prcomp: The calculation is done by a singular value decomposition of the (centered and scaled) data matrix, not by using

[R] Factor loadings and principal component plots

2004-05-03 Thread ndesnoyers
Hi- Can anyone tell me the command(s) to produce the following plots: -Factor loadings plot for principal components -Plot of principal component scores Also, apart from the prcomp (or princomp) command is there any other way to obtain principal components and if so, how does it/they stack up

[R] factor based on pattern match ?

2004-03-25 Thread Oleg Bartunov
Hello, is't possible to specify pattern in levels ? y=c(ff,f,m,mm,fm,mf,ffm,mmf,mmm,fff); factor(y) [1] ff f m mm fm mf ffm mmf mmm fff Levels: f ff fff ffm fm m mf mm mmf mmm I want to specify levels using regexp (f.*,m.*) or use some another method. So, I could have 2 levels, say,

  1   2   >