Re: [R] Not getting any result from 'gbm'?

2013-10-04 Thread David Winsemius
On Oct 3, 2013, at 3:07 PM, Mary Kindall wrote: > In the reproducible example given below, why I am not getting any result > with generalized boosted model (gbm). Other methods does show me the > desired result. > In the example data file (attached) example.txt, the predictors x3 and x4 > are co

Re: [R] try to subset zoo dataset

2013-10-04 Thread arun
Hi, Try: library(zoo) z2<- read.zoo(text="Date WBK_Last WBK_1d_Close 2003-01-03 13.88506 14.08276 2003-01-06 14.11254 13.88506 2003-01-07 14.07033 14.11254 2003-01-14 14.24165 14.30967 2003-01-22 14.28913 14.30563 2003-01-29 13.95664 14.16483 2007-01-01 14.87033 15.112

Re: [R] trying to compile R in win 7 (with Rtools) ... tcl.h

2013-10-04 Thread Joshua Wiley
Hi Cleber, When you install Rtools, it asks you the home directory of R, and there it puts a directory called src and Tcl. You need to copy those over to whereever you are making R. So for example, I have: C:\usr\R\R-devel\Tcl Where I tar -xf R devel into C:\usr\R\ and then copy the src and T

Re: [R] trying to compile R in win 7 (with Rtools) ... tcl.h

2013-10-04 Thread Cleber N.Borges
stop because *had a stone in the middle of the way* *in the middle of the way had a stone* (by vinicius de moraes) # so, one more help? somebody? :-) thanks... cleber building package 'tcltk' making init.d from init.c making tcltk.d from tcltk.c making tcltk_win.d from t

[R] make a file from four individual files. but keys can be missing among files.

2013-10-04 Thread franklin johnson
Hello, I have a list of four files. Each file is a list of gene models, and each gene model has attributes in file columns. The sample_week-over-sample_week fold change value foreach i in file is in column 5. The gene model ID is in column 1. To make it more complicated, each gene i may not be fou

Re: [R] trying to compile R in win 7 (with Rtools)

2013-10-04 Thread Tambellini William
Hi Cleber It cant find /tmp which does not exist on standard win32 mount system. Are you sure you dont have to call the "make all..." from the cygwin bash ("cygwin terminal") and not the "msdos" pseudo terminal ? W. Le 04/10/2013 17:03, Cleber N.Borges a écrit : hello all, I am trying to co

Re: [R] function with loop that goes through columns of dataframes with different dimensions

2013-10-04 Thread arun
Hi, May be this helps: set.seed(24) dat1<- as.data.frame(matrix(sample(1:50,100,replace=TRUE),10,10)) colnames(dat1)<- paste0("Col",1:ncol(dat1)) rnd.data1 <- function(x,n,ColSub,ColIndex=FALSE){  library(matrixStats)  if(ColIndex){     index <- seq_len(ncol(x))%in% ColSub   Mins1 <- colMins(x[in

Re: [R] Web Scraping

2013-10-04 Thread Ista Zahn
Hi, I have a short demo at https://gist.github.com/izahn/5785265 that might get you started. Best, Ista On Fri, Oct 4, 2013 at 12:51 PM, Mohamed Anany wrote: > Hello everybody, > I just started using R and I'm presenting a poster for R day at Kennesaw > State University and I really need some h

Re: [R] trying to compile R in win 7 (with Rtools)

2013-10-04 Thread Cleber N.Borges
bingo! :-) I got one pass to advanced! my TMP environment variable is: %SystemRoot%\TEMP thanks cleber Em 04/10/2013 22:02, Joshua Wiley escreveu: Hi Cleber, You need to set TMPDIR to a valid directory, the default /tmp/ does not work on Windows. From the cmd shell: set TMPDIR=C:/TMP

Re: [R] trying to compile R in win 7 (with Rtools)

2013-10-04 Thread Cleber N.Borges
thanks. I am logged in the MS-DOS. I thought that cygwin is not necessary... in cygwin terminal, when I type: "where sh" CLEBER@pinkfloyd /cygdrive/c $ where sh C:\cygwin\bin\sh.exe C:\Rtools\bin\sh.exe so, I have two version of "sh" and the cygwin will be priority... I will make more test an

Re: [R] trying to compile R in win 7 (with Rtools)

2013-10-04 Thread Joshua Wiley
Hi Cleber, You need to set TMPDIR to a valid directory, the default /tmp/ does not work on Windows. >From the cmd shell: set TMPDIR=C:/TMP for example and then run make all recommended Cheers, Josh On Fri, Oct 4, 2013 at 5:03 PM, Cleber N.Borges wrote: > hello all, > I am trying to compi

Re: [R] Cannot read XPT file using foreign package

2013-10-04 Thread Daniel Nordlund
There two different "transport" or "portable" file types that SAS creates: 1. using Proc CPORT 2. using the XPORT engine in a LIBNAME statement. That may not mean much to a non-SAS user, but people often use 'xpt' as a file extension for both approaches. If Proc CPORT was used to write the file

[R] trying to compile R in win 7 (with Rtools)

2013-10-04 Thread Cleber N.Borges
hello all, I am trying to compile the R in Win7 and compiles one small part but the script don't move from the 'base' directory to 'stats' I installed the Rtools likee administrator and call the terminal (MS-DOS) like administrator too. if somebody can tell me any tips, I thank in advanced cleb

Re: [R] Cannot read XPT file using foreign package

2013-10-04 Thread Dennis Fisher
Duncan I looked at support.sas.com/techsup/technote/ts140.pdf and it is a bit difficult to decipher. I then replaced the string "^@" in the file contents with "!". There is some concordance with he sample text shown in support.sas.com/techsup/technote/ts140.pdf but I don't know exactl

[R] Cannot read XPT file using foreign package

2013-10-04 Thread Dennis Fisher
OS X 10.8 R 3.0.1 foreign 0.8-55 (2013-09-02) Colleagues, I received a SAS XPT file that I cannot read using the foreign package. The command: read.xport(FILENAME) results in the following message: Error in lookup.xport(file) : file not in SAS transfer format I am able to read th

Re: [R] quote a column of a dataframe by its name

2013-10-04 Thread Rolf Turner
On 10/05/13 05:15, John Kane wrote: X[,names(X)[4]] works fine for me. I had never thought of doing this. Neat idea. Perhaps I am being obtuse, but how would X[,names(X)[4]] differ from X[,4]? cheers, Rolf Turner __ R-help@r-project.org

Re: [R] String substitution

2013-10-04 Thread irene
Wonderful! Thank you Arun! Irene   Irene Ruberto Da: arun kirshna [via R] Inviato: Giovedì 3 Ottobre 2013 22:51 Oggetto: Re: String substitution Hi, Try: dat$y<- as.character(dat$y) dat1<- dat dat2<- dat library(stringr)  dat$y[NET]<- substr(wor

[R] function with loop that goes through columns of dataframes with different dimensions

2013-10-04 Thread Katherine Bannar-Martin
Writing loops are the bane of my existence. I have this function, which works: rnd.data<-function(x){ min.x<-min(x[,2]) max.x<-max(x[,2]) min.y<-min(x[,3]) max.y<-max(x[,3]) data.table(x = runif(34, min.x, max.x))[, y := runif(34, min.y, max.y)] } it's purpose is to simulate data within parameter

[R] Web Scraping

2013-10-04 Thread Mohamed Anany
Hello everybody, I just started using R and I'm presenting a poster for R day at Kennesaw State University and I really need some help in terms of web scraping. I'm trying to extract used cars data from www.cars.com to include the mileage, year, model, make, price, CARFAX availability and Technolog

Re: [R] Subsetting Timestamped data

2013-10-04 Thread arun
Hi, May be this helps: set.seed(45) df1<- data.frame(datetime=as.POSIXct("2011-05-25",tz="GMT")+0:200*30*60,value=sample(1:40,201,replace=TRUE),value2= sample(45:90,201,replace=TRUE))  df2<- df1[ave(1:nrow(df1),as.Date(df1[,1]),FUN=length)==48,]  dim(df2) #[1] 192   3 #or library(plyr) df3<-df

[R] SSweibull() : problems with step factor and singular gradient

2013-10-04 Thread aline . frank
Dear John Nash Thank you very much for your inputs on how to fit a non-linear growth curve without running into "singular gradient". I wasn't aware of the package "nlmrt" which seems to provide very helpful functions, indeed. I'll try to figure out how nlxb() can be applied to my data (I a

Re: [R] Why 'gbm' is not giving me error when I change the response from numeric to categorical?

2013-10-04 Thread Marc Schwartz
On Oct 4, 2013, at 2:35 PM, peter dalgaard wrote: > > On Oct 4, 2013, at 21:16 , Mary Kindall wrote: > >> Y[Y < mean(Y)] = 0 #My edit >> Y[Y >= mean(Y)] = 1 #My edit > > I have no clue about gbm, but I don't think the above does what I think you > think it does. > > Y <- as.integer(Y >=

Re: [R] Why 'gbm' is not giving me error when I change the response from numeric to categorical?

2013-10-04 Thread peter dalgaard
On Oct 4, 2013, at 21:16 , Mary Kindall wrote: > Y[Y < mean(Y)] = 0 #My edit > Y[Y >= mean(Y)] = 1 #My edit I have no clue about gbm, but I don't think the above does what I think you think it does. Y <- as.integer(Y >= mean(Y)) might be closer to the mark. -- Peter Dalgaard, Professor

Re: [R] Why 'gbm' is not giving me error when I change the response from numeric to categorical?

2013-10-04 Thread Marc Schwartz
On Oct 4, 2013, at 2:16 PM, Mary Kindall wrote: > This reproducible example is from the help of 'gbm' in R. > > I ran the following code in R, and works fine as long as the response is > numeric. The problem starts when I convert the response from numeric to > binary (0/1). It gives me an erro

Re: [R] Why 'gbm' is not giving me error when I change the response from numeric to categorical?

2013-10-04 Thread Bert Gunter
"My question is, Is binarizing the response will have so much effect that it does not find anythin useful in the predictors?" Yes. Dichotomizing throws away most of the information in the data. Which is why you shouldn't do it. This is a statistics, not an R question, so any follow-up should be p

[R] Why 'gbm' is not giving me error when I change the response from numeric to categorical?

2013-10-04 Thread Mary Kindall
This reproducible example is from the help of 'gbm' in R. I ran the following code in R, and works fine as long as the response is numeric. The problem starts when I convert the response from numeric to binary (0/1). It gives me an error. My question is, is converting the response from numeric t

Re: [R] Applying and labeling scenarios

2013-10-04 Thread arun
 labels1<- paste0("[",with(allPerms,paste(A,B,C,sep="|")),"]") vals2<-as.matrix(cumsum(as.data.frame(t(allPerms  dimnames(vals2)<- list(NULL,labels1)  all.equal(vals,vals2) #[1] TRUE A.K. - Original Message - From: Keith S Weintraub To: "r-help@r-project.org" Cc: Sent: Friday, O

[R] Applying and labeling scenarios

2013-10-04 Thread Keith S Weintraub
Folks, I have a working version of the code below for my "real world" problem. I was wondering if there was a better way to do this. I have 3 sets of parameters and I want to iterate over all combinations and label the results. Would some of the plyr tools make this easier? # Input Scenarios

Re: [R] Drawing garbled

2013-10-04 Thread John Kane
Do you have the correct fonts installed on Windows? John Kane Kingston ON Canada > -Original Message- > From: cels...@163.com > Sent: Wed, 2 Oct 2013 23:51:58 +0800 (CST) > To: r-help@r-project.org > Subject: [R] Drawing garbled > > Hi: >I am Chinese, I am developing a java appl

Re: [R] Tab Separated File Reading Error

2013-10-04 Thread arun
Hi, Try: annoTranscripts<- read.csv("matched.txt", sep = '\t', stringsAsFactors = FALSE,quote="",header=FALSE)  str(annoTranscripts) 'data.frame':    367274 obs. of  12 variables:  $ V1 : chr  "comp103529_c0_seq1" "comp129123_c0_seq1" "comp129123_c0_seq1" "comp129124_c0_seq1" ...  $ V2 : chr  "XM

Re: [R] quote a column of a dataframe by its name

2013-10-04 Thread Greg Snow
Is there ever a case that X[,names(X)[4]] would give a different result than X[,4]? Or is this just a case of the "the longest distance between any 2 points is a shortcut"? Well I guess if X has non-unique names then you might see a difference, but having a data frame with non-unique names and us

Re: [R] Tab Separated File Reading Error

2013-10-04 Thread William Dunlap
> > annoTranscripts <- read.table("matched.txt", sep = '\t', stringsAsFactors = > > FALSE) > Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : > line 5933 did not have 12 elements > > However, all lines do have 12 columns. > > > lines <- readLines("matched.txt") > .

Re: [R] quote a column of a dataframe by its name

2013-10-04 Thread John Kane
X[,names(X)[4]] works fine for me. I had never thought of doing this. Neat idea. John Kane Kingston ON Canada > -Original Message- > From: jimmycl...@gmail.com > Sent: Fri, 4 Oct 2013 12:06:50 -0400 > To: r-help@r-project.org > Subject: [R] quote a column of a dataframe by its name >

Re: [R] quote a column of a dataframe by its name

2013-10-04 Thread Rui Barradas
Hello, I had no problems, and it shouldn't. What exactly do you mean by "not working"? Hope this helps, Rui Barradas Em 04-10-2013 17:06, Jie escreveu: Dear All, I have a question, suppose X is a dataframe, with column names as "x1", "x2", "x3", . And I would like to use the i-th colum

Re: [R] quote a column of a dataframe by its name

2013-10-04 Thread Jie
Sorry, this sample code seems to be OK. I will look into my original problem and update it soon. Best wishes, On Fri, Oct 4, 2013 at 12:06 PM, Jie wrote: > Dear All, > > I have a question, suppose X is a dataframe, with column names as > "x1", "x2", "x3", . And I would like to use the i-th

[R] quote a column of a dataframe by its name

2013-10-04 Thread Jie
Dear All, I have a question, suppose X is a dataframe, with column names as "x1", "x2", "x3", . And I would like to use the i-th column by X[,'xi']. But it seems the single quote and double quote are different. So if I run X[, names(X)[i]], it has some error. Please use the below example code

Re: [R] abline is not plotting

2013-10-04 Thread S Ellison
> I have some data I want to plot together with a best-fit line. (see MWE > below) ... > Can someone help me with that? What am I doing wrong? Not logging the lm. Also, you've calculated lm() the wrong way round; you've regressed x on y. Try plot(log(d), xlab="log(x)", ylab="log(y)") abline(l

Re: [R] time series has no or less than 2 periods

2013-10-04 Thread Clint Bowman
Perhaps looking at your data will suggest an appropriate number, viz. plot(data,type="b",xlim=c(0,20),ylim=c(0,50)) par(new=T) ind<-1:19 # in this case where the data length is 19 data.ind<-data.frame(ind,data) data.lo<-loess(data~ind,data.ind) data.pre<-predict(data.lo,data.frame(ind = seq(1,19

Re: [R] abline is not plotting

2013-10-04 Thread John Kane
Well you logged the x and y values before plotting but did not log the lm(). I think this means you have plotted abline() off the scale. I'm not sure how to fix it though. John Kane Kingston ON Canada > -Original Message- > From: hans_han...@gmx.de > Sent: Fri, 4 Oct 2013 07:16:49 -0

[R] abline is not plotting

2013-10-04 Thread hans74
Hello there, I have some data I want to plot together with a best-fit line. (see MWE below) The points from the first plot does appear as expected, but the abline does not appear, no matter what I change. I removed the log parameter before, but the abline is a very steep line around the origin. I

Re: [R] Trying to avoid nested loop

2013-10-04 Thread arun
Hi, set.seed(49)  X = matrix(rnorm(100), 10, 10) X1<- X result<-0 for(m in 1:nrow(X)){  for(n in 1:ncol(X)){    if(X[m,n] != 0){  result = result + (X[m,n] / (1 + abs(m - n)))    }  }} indx<-which(X!=0,arr.ind=TRUE)  indx1<-1+abs(indx[,1]-indx[,2]) X1[indx]<- X1[indx]/indx1 #or re

[R] Tab Separated File Reading Error

2013-10-04 Thread Dario Strbenac
Hello, I have a seemingly simple problem that a tab-delimited file can't be read in. > annoTranscripts <- read.table("matched.txt", sep = '\t', stringsAsFactors = > FALSE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 5933 did not have 12 elements However

[R] Subsetting Timestamped data

2013-10-04 Thread aj409
Hi, I have a data frame, data, containing two columns: one- the TimeStamp (formatted using data$TimeStamp <- as.POSTIXct(as.character(data$TimeStamp), format = "%d/%m/%Y %H:%M") ) and two- the data value. The data frame has been read from a .csv file and should contain 48 values for ea

Re: [R] R-help Digest, Vol 128, Issue 5

2013-10-04 Thread TAPO (Thomas Agersten Poulsen)
Hi Peter, The ssconvert tool (part of gnumeric) is very good at converting spreadsheets to csv-files. There is a wrapper in the "gnumeric" package on cran. Cheers, Thomas > Date: Fri, 4 Oct 2013 09:08:50 +0100 > From: Barry Rowlingson > To: Peter Maclean > Cc: "r-help@r-project.org" > Subjec

Re: [R] Tex-mining in R

2013-10-04 Thread umesh khatri
Thanks Ista, Can you please suggest any useful link(s) which explain RcmdrPlugin.temis and tm package other than Cran-R one? Thanks Umesh On Tue, Oct 1, 2013 at 11:40 PM, Ista Zahn wrote: > Do you know about task views? Try > http://cran.r-project.org/web/views/NaturalLanguageProcessing.html

Re: [R] Trying to avoid nested loop

2013-10-04 Thread arun
Hi, set.seed(49)  X = matrix(rnorm(100), 10, 10) X1<- X result<-0 for(m in 1:nrow(X)){  for(n in 1:ncol(X)){    if(X[m,n] != 0){  result = result + (X[m,n] / (1 + abs(m - n)))    }  }} indx<-which(X!=0,arr.ind=TRUE)  indx1<-1+abs(indx[,1]-indx[,2]) X1[indx]<- X1[indx]/indx1 #or

Re: [R] time series has no or less than 2 periods

2013-10-04 Thread Daniel Hickman
Bill, Thanks for replying. The data is weekly time series data. Assume there is 52 weeks in the year. Of the 52 weeks, I typically only have data for weeks 8 through 40. 4-Apr-10, 8, 27.2 11-Apr-10, 9, 32.3 18-Apr-10, 10, 31.7 DataXYZ, 40, 13.4 data <- c(0,24.57,29.93,24.19,12.25,48.07,

Re: [R] Trying to avoid nested loop

2013-10-04 Thread philippe massicotte
Thank you for your answer. This is what I needed. > From: s.elli...@lgcgroup.com > To: r-help@r-project.org > Date: Fri, 4 Oct 2013 15:13:49 +0100 > Subject: Re: [R] Trying to avoid nested loop > > > > I'm trying to avoid using nested loops in the following code but I'm > > not sure how to pro

Re: [R] climstats 'spatial_sync_raster' function

2013-10-04 Thread Jenny Williams
The function I have been trying to use is: spatial_sync_raster The maintainer has let me know that this is available in his spatial.tools package, which you can get from CRAN: install.packages("spatial.tools") problem solved. Thanks jenny -Original Message- From: David Winsemius [mai

Re: [R] Trying to avoid nested loop

2013-10-04 Thread S Ellison
> I'm trying to avoid using nested loops in the following code but I'm > not sure how to proceed. Any help would be greatly appreciated. > With regards,Phil > X = matrix(rnorm(100), 10, 10) > result = 0 > for(m in 1:nrow(X)){ > for(n in 1:ncol(X)){ > if(X[m,n] != 0){

Re: [R] Counting numbers in R

2013-10-04 Thread Shane Carey
I got sorted, Thanks all On Fri, Oct 4, 2013 at 2:03 PM, S Ellison wrote: > > I have a set of data and I need to find out how many points are below a > > certain value but R will not calculate this properly for me. > R will. But you aren't. > > > Negative numbers seem to be causing the issue.

[R] Trying to avoid nested loop

2013-10-04 Thread philippe massicotte
Dear R users. I'm trying to avoid using nested loops in the following code but I'm not sure how to proceed. Any help would be greatly appreciated. With regards,Phil X = matrix(rnorm(100), 10, 10) ## Version with nested loopsresult = 0 for(m in 1:nrow(X)){ for(n in 1:ncol(X)){if(X[m,n] !=

[R] Trying it 'isolate' correctly in Shiny

2013-10-04 Thread Dimitri Liakhovitski
Hello! I am learning Shiny. In my ui am allowing the user to read in 3 files. Here is a piece of my ui.r code: sidebarPanel( fileInput('file1','Select File 1:'), fileInput('file2','Select File 2:'), fileInput('fileopt','Select Optional File:'), actionButton("goButton","RUN") )

Re: [R] Interpreting the result of a Wilcoxon (Mann-Whitney U) test

2013-10-04 Thread S Ellison
> -Original Message- > Got it! I agree it should had been more obvious to me... :) I wouldn't feel too bad about that. I've spent most of the last 25 years discovering the hard way that statistics is very much a field where things are 'obvious' only _after_ you know the answer... S

Re: [R] vif

2013-10-04 Thread eliza botto
Dear Arun,Thanks indeed > Date: Thu, 3 Oct 2013 10:22:38 -0700 > From: smartpink...@yahoo.com > To: r-help@r-project.org > Subject: Re: [R] vif > > Hi Eliza, > > Then, "res" needs a slight modification > > > library(car) > res<- lapply(colnames(h),function(x) {x1<- h[,x];dat1<- > do.call(rbi

[R] SSweibull() : problems with step factor and singular gradient

2013-10-04 Thread Prof J C Nash (U30A)
I think you have chosen a model that is ill-suited to the data. My initial thoughts were simply that the issue was the usual nls() "singular gradient" (actually jacobian if you want to be understood in the optimization community) woes, but in this case the jacobian really is bad. My quick an

Re: [R] Counting numbers in R

2013-10-04 Thread S Ellison
> I have a set of data and I need to find out how many points are below a > certain value but R will not calculate this properly for me. R will. But you aren't. > Negative numbers seem to be causing the issue. You haven't got any negative numbers in your data set. In fact, you haven't got any nu

Re: [R] lattice multi-panel layout

2013-10-04 Thread Duncan Mackay
Hi I have never used the automap package and your syntax for xyplot does not seem to be in the correct format for lattice. A quick search showed that vgm.panel.xyplot from gstat package may give you some ideas. It appears that there are some particular adaptations for lattice for spatial plot

Re: [R] prcomp - surprising structure

2013-10-04 Thread peter dalgaard
On Oct 3, 2013, at 16:30 , Hermann Norpois wrote: > Thanks for answering. > > I already started hunting. But my first doubt was if I used prcomp correctly > (and this is in the moment my most important point). So far as I understood > your answer is yes. Is that correct? Yes. There are a cou

Re: [R] Importing odf file into R

2013-10-04 Thread John Kane
Assuming you want to read in data from an AOO or LO spreadsheet, have a look at the gnumeric package. I have only used it once or twice but it seems to work well and is quite flexible. John Kane Kingston ON Canada > -Original Message- > From: pmaclean2...@yahoo.com > Sent: Thu, 3 Oct

Re: [R] Random Projection

2013-10-04 Thread Stefan Evert
On 3 Oct 2013, at 22:39, "Monaghan, David" wrote: > I was wondering, has anyone has encountered an R package that performs random > projection/random mapping? RP is a procedure that is akin to Principal > Components Analysis in that it accomplishes dimensionality reduction, but is > far more

Re: [R] lattice multi-panel layout

2013-10-04 Thread efx
Hi, thanks. the printing one by one seems the only working solution. I also tried the grid.arrange function but couldnt output what I am after. Now the plots are placed in one page but I got the message "error using packet 1: promise already under evalution: recursive default arguments reference

Re: [R] Importing odf file into R

2013-10-04 Thread Barry Rowlingson
On Fri, Oct 4, 2013 at 5:57 AM, Peter Maclean wrote: > Anyone aware of a package or technique to import odf data file into R, I will > appreciate his/her help. A quick scan of R-help points me here: http://www.omegahat.org/ROpenOffice/ Reports of that working (or not) would be appreciated - I'