[R] R function for Bisecting K-means algorithm

2013-10-07 Thread Vivek Singh
Hi All, Can someone please tell me* R function for Bisecting K-means algorithm*. I have used *kmeans() *function but not getting good results. Please help. -- Thanks and Regards, Vivek Kumar Singh Research Assistant, School of Computing, National University of Singapore Mobile:(0065) 82721535

Re: [R] Need help with plotting the graph

2013-10-07 Thread PIKAL Petr
Hi Your data frame is a bit weird. I changed it to more standard structure df<-as.data.frame(lapply(df, unlist)) You can concatenate labels to one character vector x<-with(df, paste(disk, vmfs, vmdk, sep="-")) Then you can use barplot, however labels are quite long to fit. barplot(df$BW, names=

Re: [R] Need help with plotting the graph

2013-10-07 Thread Prasad Joshi
On Tue, Oct 8, 2013 at 2:01 AM, Jim Lemon wrote: > On 10/07/2013 09:02 PM, Prasad Joshi wrote: >> >> Hello All, >> >> >> I would like Y axis to represent BW and X axis to represent disk, vmfs and >> vmdk. >> >> All the examples in books or online have single X axis. I could not >> find an exa

Re: [R] Need help with plotting the graph

2013-10-07 Thread Prasad Joshi
On Tue, Oct 8, 2013 at 1:48 AM, David Carlson wrote: > First. You should update R to the latest version, 3.0.2. > Hello David, Thanks a lot for your reply. I will update R. > > Third. Use dput(df) and send the output to the mailing list. A > data frame usually consists of several vectors, not se

Re: [R] Centering multi-level unordered factors

2013-10-07 Thread David Winsemius
On Oct 7, 2013, at 4:52 PM, Robert Lynch wrote: > I have a question I am not even sure quite how to ask. > > When r fits models with un-ordered categorical variables as predictors > (RHS of model) it automatically converts them into 1 less dichotomous > variables than there are levels. > > For

[R] Centering multi-level unordered factors

2013-10-07 Thread Robert Lynch
I have a question I am not even sure quite how to ask. When r fits models with un-ordered categorical variables as predictors (RHS of model) it automatically converts them into 1 less dichotomous variables than there are levels. For example if I had levels(trait) = ("A","B","C") it would automa

Re: [R] FW: Transposing the output of 'table'

2013-10-07 Thread peter dalgaard
On Oct 6, 2013, at 20:25 , Andrea Lamont wrote: > If t(table(OBJECT)) does not work, does: > u<-as.matrix(table(OBJ)) > t(u) > > -i.e. use matrix operations? Please try before posting... table() results in a 1d table, i.e. a vector; t() of a vector is a row matrix, so it still displays horis

Re: [R] Transposing the output of 'table'

2013-10-07 Thread Law, Jason
If you want a dataframe rather than a matrix, I often use the as.data.frame method for table objects. See ?table for the documentation. You can even nicely name the dimensions and frequency. OBJECT <- sample(4, 20, TRUE) as.data.frame(table(var1 = OBJECT), responseName = 'frequency') Jason

Re: [R] Color font in verbatim text output in Shiny

2013-10-07 Thread David Reiner
inline below. HTH, -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Liakhovitski Sent: Monday, October 07, 2013 11:04 AM To: r-help Subject: [R] Color font in verbatim text output in Shiny Hello! Is there any way t

Re: [R] Subsetting Timestamped data

2013-10-07 Thread MacQueen, Don
Here is an approach using base R tools (not tested, so I hope I don't embarrass myself!) dayid <- format(data$TimeStamp, '%Y-%m-%d') day.counts <- table(dayid) good.days <- names(day.counts)[day.counts == 48] subset(data, dayid %in% good.days) This could be written in a one-liner, but it's much e

Re: [R] Need help with plotting the graph

2013-10-07 Thread Jim Lemon
On 10/07/2013 09:02 PM, Prasad Joshi wrote: Hello All, I would like Y axis to represent BW and X axis to represent disk, vmfs and vmdk. All the examples in books or online have single X axis. I could not find an example which does something similar to what I am trying. Can anyone please giv

Re: [R] Need help with plotting the graph

2013-10-07 Thread David Carlson
First. You should update R to the latest version, 3.0.2. Second. What commands have you tried and what error messages did you receive? Third. Use dput(df) and send the output to the mailing list. A data frame usually consists of several vectors, not several lists. It might be necessary to explain

[R] GLM: Defining non-constant variance for (gaussian) family

2013-10-07 Thread Christoph Häni
Dear all, I want to fit some observations Y to a set of predictor variables X_i. (and proceed with model selection with support of the second-order AIC (AICc)...) I (think I) "know" that the distribution of Y[i] is Gaussian and has a variance, which is proportional to its value Y[i]. Say: x1 <- r

[R] plotting the predict values of time series

2013-10-07 Thread meng
Hi all: I met a question about plotting the predict values of time series. The data is treering which belongs to R. I want to predict the next 3 years(1980,1981,1982) result. pred<-predict(ar(treering),n.ahead=3) plot(treering) lines(pred$pred,col="red",lwd=3) I can only find a little bit red

[R] interacting with the user: programming r in order to ask questions to the user

2013-10-07 Thread Jacopo
hello everyone. I am trying to create a model in which R asks some questions to the user, and the user answer to them. I have already create two vector; In one there are number ex 1,2,3,4,5,6,7,8,9,10 and in the other there are "word" ex one, two, three, four. I would like to create a script that a

Re: [R] Information Frequency problem calculation

2013-10-07 Thread David Carlson
If you want a symmetric table, try this: > a<- read.table(text="Name1 Name2 category + mauro francesco E234 + luca giuseppe E5578 + luca franco E5569 + maria luca E4556",sep="",header=TRUE,stringsAsFactors=FALSE) > names <- sort(unique(c(a$Name1, a$Name2))) > a$Name1 <- factor(a$Name1, names)

[R] Need help with plotting the graph

2013-10-07 Thread Prasad Joshi
Hello All, The version of R I am using is as follows > version _ platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 14.1 year 2011 month 12 day22 svn

[R] Interpretation of coefficients in spatial lag models

2013-10-07 Thread Gary Dong
Dear R users, I have estimated a spatial lag model using the "spdep" package. I understand that to interpret the magnitude of coefficients correctly, I have to use impact() to calculate the direct and indirect impacts. Here are the estimation results for a variable X, which is statistically signi

Re: [R] Information Frequency problem calculation

2013-10-07 Thread arun
Hi, Not sure what your expected output would be: a<- read.table(text="Name1 Name2 category mauro francesco E234 luca  giuseppe  E5578 luca  franco  E5569 maria luca E4556",sep="",header=TRUE,stringsAsFactors=FALSE) sapply(seq_len(nrow(a)),function(i) sum(a[,2] %in% a[i,1])) #[1] 0 1 1 0 A.K.

Re: [R] Information Frequency problem calculation

2013-10-07 Thread jim holtman
does 'table' do the job for you? > input <- read.table(text = "Name1 Name2 category + + mauro francesco E234 + luca giuseppe E5578 + luca franco E5569 + maria luca E4556", header = TRUE, as.is = TRUE) > input Name1 Name2 category 1 mauro francesco E234 2 luca giuseppeE5578 3

[R] Indirect Association Rules

2013-10-07 Thread Flavio Barros
There is some implementation on R for the IDARM algorithm? http://link.springer.com/chapter/10.1007%2F3-540-32392-9_9#page-1 in fact any implementation of indirect association rules would be usefull. Flavio Barros [image: Facebook]

[R] Information Frequency problem calculation

2013-10-07 Thread jarod...@libero.it
Dear All, I Have a dataframe like that: Name1 Name2 category mauro francesco E234 luca giuseppe E5578 luca franco E5569 maria luca E4556 ... I would like to calculate the frequency of many time in my data I found in the list name: a<-read.table("pippo.csv",header=T,sep="\t") name1<-as.c

Re: [R] Growth calculation

2013-10-07 Thread Sarah Goslee
I'd suggest searching for "absolute growth rate" and "relative growth rate" and choosing the metric most suited to your question of interest. Sarah On Monday, October 7, 2013, wrote: > Hi, >This is not a sophisticated statistics question as the subject > suggests. But I am logging data -

[R] Color font in verbatim text output in Shiny

2013-10-07 Thread Dimitri Liakhovitski
Hello! Is there any way to change the colors (and other characteristics) of the font that is being used by Shiny when the ui.r code hase some verbatimTextOutput? For example, I am producing 2 outputs in two tabs. mainPanel( tabsetPanel( tabPanel("Output 1", verbatimTextOutput("myoutput

Re: [R] Why read.table replacing space with "." in the header

2013-10-07 Thread arun
Hi, Use `check.names=FALSE` head(dd,2) #  Phylo.Tree Genesis.Tree #1  1    2 #2  2    3  dd <- data.frame("Phylo Tree"= c(1:10), "Genesis Tree"= c(2:11),check.names=FALSE) head(dd,2) #  Phylo Tree Genesis Tree #1  1    2 #2  2    3

Re: [R] Data Frame Operation: Replace values based on contraints

2013-10-07 Thread arun
Hi, Try: datNew <- read.table(text=as.character(mydata$NATIONALITY),sep="_")  mydata2 <- within(mydata,{NATIONALITY <- as.character(datNew[,1]);YEAR <- datNew[,2]})  head(mydata2) # PROVINCE  AGE5 ZONA91OK NATIONALITY FREQUENCY YEAR #1   1 10-14  101   SPAIN   600 1998 #

Re: [R] Data Frame Operation: Replace values based on contraints

2013-10-07 Thread arun
Hi, Try: datNew <- read.table(text=as.character(mydata$NATIONALITY),sep="_")  mydata2 <- within(mydata,{NATIONALITY <- as.character(datNew[,1]);YEAR <- datNew[,2]})  head(mydata2) # PROVINCE  AGE5 ZONA91OK NATIONALITY FREQUENCY YEAR #1   1 10-14  101   SPAIN   600 1998 #501

Re: [R] convert data.frame to parameters

2013-10-07 Thread Charles Annis
Yup. You saved the day with "assign." Works like a champ. Thanks too for the "do.call" suggestion. It turns out, however, that I'm using all these objects (parameters) in a more complex code, and not a single function call. Thanks again! Charles Annis, P.E. charles.an...@statisticalengine

Re: [R] convert data.frame to parameters

2013-10-07 Thread Bert Gunter
1. ?assign is what you're looking for, I think. 2. But I would guess that you do not need to do this. As a further guess, see ?do.call for creating a function call that you can give a list of arguments/parameters. Cheers, Bert On Mon, Oct 7, 2013 at 6:07 AM, Charles Annis wrote: > Sorry for usi

Re: [R] Why read.table replacing space with "." in the header

2013-10-07 Thread arun
Hi, Use `check.names=FALSE` head(dd,2) #  Phylo.Tree Genesis.Tree #1  1    2 #2  2    3  dd <- data.frame("Phylo Tree"= c(1:10), "Genesis Tree"= c(2:11),check.names=FALSE) head(dd,2) #  Phylo Tree Genesis Tree #1  1    2 #2  2   

Re: [R] convert data.frame to parameters

2013-10-07 Thread Charles Annis
Sorry for using "parameters" when I meant "objects." I also wasn't sufficiently clear about what I'm trying to do. Your suggestion produces a single object, "parameters." What I want are 26 objects, a , b, c, ... whose values are df$values, which in my case are numeric. Thanks. Charles Annis,

Re: [R] convert data.frame to parameters

2013-10-07 Thread Duncan Murdoch
On 07/10/2013 7:56 AM, Charles Annis wrote: Greetings: I have a 24 row, 2-column csv file. The first column is character, with the names of parameters. The second column is numeric, containing the parameter values. I can produce a 2-column data.frame with case.study.parameters <- read.csv(.

[R] convert data.frame to parameters

2013-10-07 Thread Charles Annis
Greetings: I have a 24 row, 2-column csv file. The first column is character, with the names of parameters. The second column is numeric, containing the parameter values. I can produce a 2-column data.frame with case.study.parameters <- read.csv(...) I want to convert the data.frame to 24 pa

Re: [R] abline is not plotting

2013-10-07 Thread hans74
Hi, it works now! Thanks to you both. I thought abline with the lm inside uses the already plotted x- and y-axes automatically, as it does for a abline( h = ... ), for example. Applying the logarithm on the lm-data fixes the graph. Thank you, Hans -- View this message in context: http://r.7

[R] Growth calculation

2013-10-07 Thread mohan . radhakrishnan
Hi, This is not a sophisticated statistics question as the subject suggests. But I am logging data - number of user sessions in a web application - before and after new users are migrated. I use R to graph but I am looking for a way to quantify the growth in the number of user sessions.

Re: [R] kill colnames Matrix

2013-10-07 Thread PIKAL Petr
Hi First of all do not mix data frame and matrix, they have quite different properties. By transposing data frame you got character matrix and you cannot do barplot with characters. So you shall transpose only column PT_SATZ and add names from MONTHS but why not to use your data frame directly

[R] R: Group all the consecutive days

2013-10-07 Thread Stefano Sofia
Jim, sorry for the delay of my answer. The code works very well, thank you for your support. I am a meteorologist and I am helping a geologist in some studies step by step. As the time being this is exactly what I wanted to do. Thank you Stefano Da: jim hol

[R] kill colnames Matrix

2013-10-07 Thread Mat
Hello together, i have a little problem, maybe you can help me. I have a matrix like this one: [,1] [,2] [,3] [,4] [,5] MONTH "2012-10""2012-11""2012-12""2013-01""2013-02" PT_SATZ " 0.0" "