Re: [R] convert list to Dataframe

2009-11-01 Thread onyourmark
t), + readerControl = list(language = "lat"))) then twitter <- tm_map(twitter, removeWords, stopwords("english")) That last command took about an hour to complete. onyourmark wrote: > > Hi. I have a huge list called twitter: > >> dim(twitter) >

Re: [R] convert list to Dataframe

2009-11-01 Thread onyourmark
uot;, "hour", "mday", "mon", "year", "wday", "yday", "isdst" ), class = c("POSIXt", "POSIXlt"), tzone = "GMT"), creator = structure("", .Names = "LOGNAME")), .Names = c(&q

[R] convert list to Dataframe

2009-11-01 Thread onyourmark
Hi. I have a huge list called twitter: > dim(twitter) NULL > str(twitter) List of 1 $ :Classes 'PlainTextDocument', 'TextDocument', 'character' atomic [1:35575] 11999;10:47:14;20;10;2009;ObamaLouverture;Trails Mixed Lessons For Governance From Campaigner-in-chief: President obama jumps campaig

Re: [R] meaning of glm(value ~ .,

2009-06-19 Thread onyourmark
at it was not the dependent variable but rather one of the independent ones. Thanks again. Gavin Simpson wrote: > > On Fri, 2009-06-19 at 09:24 -0400, David Winsemius wrote: >> On Jun 19, 2009, at 9:00 AM, onyourmark wrote: > >> > means and also, I see >> > >> &

[R] meaning of glm(value ~ .,

2009-06-19 Thread onyourmark
I am trying to build a glm model with many inputs. I saw the following code in Rattle crs$glm <- glm(value ~ ., data=crs$dataset[,c(1:59,922)], family=binomial(link="logit")) I am not clear about what value ~ . means and also, I see data=crs$dataset[,c(1:59,922)] I have read that the data

Re: [R] how to sort

2009-06-18 Thread onyourmark
] > > May be you can also try force PC1 to be numeric with:. > > > orderedCorTFandPCA=dfCorTFandPCA[order(as.numeric(as.character(dfCorTFandPCA$PC1))),] > > Good luck > > milton > brazil=toronto > > > > > > On Wed, Jun 17, 2009 at 11:16 PM, o

[R] how to sort

2009-06-17 Thread onyourmark
Hi. I have an object. I think it is a list. > str(corTFandPCA) num [1:922, 1:5] -0.0226 -0.0504 -0.0208 -0.0582 -0.0257 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:922] "abdomen.2" "abdomimal.3" "abdominal.4" "aberration.5" ... ..$ : chr [1:5] "PC1" "PC2" "PC3" "PC4" ... I want to ord

[R] what is 'class.ind' here?

2009-05-30 Thread onyourmark
Hi. The there is an example in nnet help which is pasted in below. I am not sure how they are generating 'targets'. What is the 'class.ind() function doing? In the help docs for it they say "Generates a class indicator function from a given factor." I tried putting a simple vector of the "classes"

Re: [R] accuracy of a neural net

2009-05-25 Thread onyourmark
It looks promising. I saw the pdf at:http://cran.r-project.org/web/packages/caret/vignettes/caretMisc.pdf. I will give it a try. Thank you. onyourmark wrote: > > Hi. I started with a file which was a sparse 982x923 matrix and where the > last column was a variable to be predict

[R] accuracy of a neural net

2009-05-24 Thread onyourmark
Hi. I started with a file which was a sparse 982x923 matrix and where the last column was a variable to be predicted. I did principle component analysis on it and arrived at a new 982x923 matrix. Then I ran the code below to get a neural network using nnet and then wanted to get a confusion matrix

[R] if ((x >.2 || x<(-.2)) && (col(x)!=row(x))) {x=x[,-col(x)]}

2009-05-07 Thread onyourmark
Hi. I have a correlation matrix 'x' which is of size 923x923 I need to remove variables that are highly correlated. I don't have a sophisticated way of selecting which of the two in a highly correlated pair to remove. I thought I would just go through each entry of the correlation matrix and if i

[R] print value of variable to screen or alert box?

2009-05-02 Thread onyourmark
I am trying to debug a loop. Is there a way to print the value of a variable that is inside a loop? I have a vector v and inside a loop I have v[i] where i is the index of the loop. Is there a way to see v[i] per loop so that I can see what is going on? Thanks -- View this message in context: ht

[R] any suggestions on this error?

2009-05-01 Thread onyourmark
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, : invalid 'ncol' value (too large or NA) the statement was: for (i in v) {for (j in m[0,]){if(v[i]==m[0,j]){M[,-j]}}} where 'v' is a vector, and 'm' and 'M' are both matrices. -- View this message in context:

[R] re moving entries from one vector that are in another

2009-04-26 Thread onyourmark
I have various objects defined but I am trying to remove a set of elements in one vector from another and using the loops at the end of this post but I am getting the error at the very end of this post. > str(x) num [1:923, 1:923] 1 -0.00371 -0.00102 -0.00204 -0.00102 ... - attr(*, "dimnames")=

Re: [R] deleting rows provisionally

2009-04-24 Thread onyourmark
f I wanted instead to switch the elements of the first and second column whenever they are different what would I do? confused. Ben Bolker wrote: > > > > onyourmark wrote: >> >> I have an object. I think it is a matrix, called 'answer2' >> str(answer2) &

[R] deleting rows provisionally

2009-04-23 Thread onyourmark
I have an object. I think it is a matrix, called 'answer2' str(answer2) int [1:1537, 1:2] 1 399 653 2 3 600 4 5 271 870 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:1537] "a4.1" "hirschsprung.399" "peritoneal.653" "abdomen.2" ... ..$ : chr [1:2] "row" "col" I want to delete rows that

Re: [R] search through a matrix

2009-04-21 Thread onyourmark
sis on? Thanks. Uwe Ligges-3 wrote: > > > > onyourmark wrote: >> Hi. I have a 925 by 925 correlation matrix corM. I want to identify all >> variables that have correlation greater than 0.9. Can anyone suggest an >> "R >> way" of doing this? >

Re: [R] search through a matrix

2009-04-21 Thread onyourmark
Winsemius wrote: > > > On Apr 21, 2009, at 8:33 AM, onyourmark wrote: > >> >> Thanks very much. >> >> I don't really understand the row() function. I looked in the >> reference but >> I don't really get it. It says: >> Description >>

Re: [R] search through a matrix

2009-04-21 Thread onyourmark
single square bracket notation accepts a pair separated by a comma but I don't see how row(x)==col(x) produces that? Thanks again. onyourmark wrote: > > Hi. I have a 925 by 925 correlation matrix corM. I want to identify all > variables that have correlation greater than 0.9. Can a

[R] search through a matrix

2009-04-21 Thread onyourmark
Hi. I have a 925 by 925 correlation matrix corM. I want to identify all variables that have correlation greater than 0.9. Can anyone suggest an "R way" of doing this? Thank you. -- View this message in context: http://www.nabble.com/search-through-a-matrix-tp23153538p23153538.html Sent from th

[R] factanal error

2009-04-20 Thread onyourmark
Hi. I tried running the following code. I don't understand the error. mydata <- read.table("C:/dataForR/radiology/wordFrequencies.csv", header=TRUE, sep=",") > dim(mydata) [1] 982 924 mydataN<-mydata[,-923] > dim(mydataN) [1] 982 923 cor(mydataN) factanal(mydataN, factors=3) Error in solve.d

[R] system is exactly singular

2009-04-20 Thread onyourmark
Hi. I have a csv file. I imported it with mydata<-read.table("C:/dataForR/radiology/WordFrequency.csv", header=TRUE, sep=",") > dim(mydata) [1] 982 925 The first column had the doc numbers like doc1, doc2, etc. so I did mydataNum<-mydata[,-1] > dim(mydataNum) [1] 982 924 The second to last co

[R] question about the Text Mining package tm

2009-04-16 Thread onyourmark
Hello. I am trying to work with the text mining package tm. I have a directory called textsTweet1 which contains three files short.txt myTextFile.txt myTextFile.csv short.txt contains one line: THE CAT IN THE HAT\n myTextFile contains some tweets from Twitter. The first few lines of myTextFile.

Re: [R] number of zeros in a matrix -row by row

2009-04-06 Thread onyourmark
oh boy, what a mistake. Ok, I will try that and look up what it means afterward. Thank you. MUHC-Research wrote: > > Hi, > > Try > > /rowSums(M==0)/ > > This should work just fine. > > Cheers, > > Luc > > onyourmark wrote: >> Hi. I have an n

Re: [R] number of zeros in a matrix -row by row

2009-04-05 Thread onyourmark
'closure' is not subsettable What am I doing wrong? Thanks so much. Dimitris Rizopoulos-4 wrote: > > if 'M' is your matrix, then try this: > > rowSums(M == 0) > > > I hope it helps. > > Best, > Dimitris > > > onyourmark wrote

[R] number of zeros in a matrix -row by row

2009-04-05 Thread onyourmark
Hi. I have an n x m matrix M some of who's entries are zeros. I want to know how many zeros there are in each row-perhaps stored in a 1 x n vector which lists the number of zeros for each row of M. Before I had a vector V and I was able to get the number of zeros in V by doing length(V[ V==0]

Re: [R] how to do this "the R way"

2009-04-04 Thread onyourmark
entry from TS2 and therefore choosing that column (and 100th row). A little difficult to get my head around it but it works. Thanks a lot. onyourmark wrote: > > WOW. Is it really that compact? I will give it a try. Amazing if true. > Thanks. > > Patrick Burns wrote: >> >&g

Re: [R] how to do this "the R way"

2009-04-04 Thread onyourmark
Patrick Burns > patr...@burns-stat.com > +44 (0)20 8525 0696 > http://www.burns-stat.com > (home of "The R Inferno" and "A Guide for the Unwilling S User") > > onyourmark wrote: >> Hi. >> newTS2 =(perm[100.TS2[1]]. perm[100.TS2[2]]. perm[100.TS2[3]

Re: [R] how to do this "the R way"

2009-04-04 Thread onyourmark
(100,5) element from perm to be the first entry in newTS2. Does this make sense? Thanks. onyourmark wrote: > Hi. I am sure there is a better way in R to do this then using a loop but > I > am new to it and not sure what to do. I think it might be something about > using a function as

[R] how to do this "the R way"

2009-04-03 Thread onyourmark
Hi. I am sure there is a better way in R to do this then using a loop but I am new to it and not sure what to do. I think it might be something about using a function as an argument but not sure. I have a 1 x 2000 vector TS2 which has entries from the set {x: x is in Z and 0http://www.nabble.com/

[R] permutations in R

2009-03-13 Thread onyourmark
Hi. Does anyone know of a function which will take as input a number n (or a set of n letters) and will give out, one at a time, the permutations of n (or of those n letters) as a vector? So that I can use the permutations one at a time. And such that it will exhaust all the permutations with no r