Re: [R] i'm so stuck with text file and contour plot

2009-08-05 Thread Tal Galili
Hi Hannes, >From my experience, this error usually happens when you've got spaces in the header row, in the column names. An easy solution would be to open the file in excel, then run search-and-replace on the header row for all spaces and replace them with a hyphen "-". Hope it helped (please let

Re: [R] Caculate first difference from a dataframe; write a simulation

2009-08-05 Thread David Winsemius
On Aug 4, 2009, at 2:12 PM, Meenu Sahi wrote: Dear R Users I'm writing my first simulation in R. I've put across my problems with a smaller example in the attachment along with the questions. Please help. See Simpson reply to Q1 ##Question2: How can I easily identify which out of the 9

Re: [R] Scientific Format E

2009-08-05 Thread Henrique Dallazuanna
Another options is: sprintf("%.0E", 0.2) On Wed, Aug 5, 2009 at 9:18 AM, Henrique Dallazuanna wrote: > You can try this: > toupper(format(0.2, scientific = TRUE)) > > > On Wed, Aug 5, 2009 at 9:05 AM, Wittmer, Irene wrote: > >> >> Dear Helpers, >> >> I would like to export a large dataset to a tx

Re: [R] problem with pattern matching

2009-08-05 Thread jim holtman
I think you want to use either 'match' or '%in%' x <- dataframe$ID %in% list$ID # TRUE if it is in list On Wed, Aug 5, 2009 at 5:36 AM, Rnewbie wrote: > > I wanted to extract my interested rows from a dataframe. I used: > > grep(list$ID, dataframe$ID, value=T) #list contains a list of my interes

Re: [R] Scientific Format E

2009-08-05 Thread jim holtman
Use 'sprintf' to format your data before writing out: > sprintf("%G", runif(10,1e6, 1e10)) [1] "3.67382E+09" "9.47111E+09" "1.02591E+09" "5.368E+09" "8.17346E+08" "2.89006E+09" "6.62398E+09" "1.29721E+09" "9.99348E+09" [10] "6.73539E+09" On Wed, Aug 5, 2009 at 8:05 AM, Wittmer, Irene wrote: > >

Re: [R] Scientific Format E

2009-08-05 Thread Henrique Dallazuanna
You can try this: toupper(format(0.2, scientific = TRUE)) On Wed, Aug 5, 2009 at 9:05 AM, Wittmer, Irene wrote: > > Dear Helpers, > > I would like to export a large dataset to a txt file in order to use it > in an other programm. > Unfurtunatly the R the scientific format is a small e: > > 2 e-1

Re: [R] help:Vector vs array

2009-08-05 Thread jim holtman
"Intro to R" should tell you. A vector is basically a one-dimensional object (addressed x[i]) and an array has multiple dimensions (addressed x.array[i,j,k]). What confusion do you have? Think of a 2-dimensional array as a matrix or an Excel worksheet. On Wed, Aug 5, 2009 at 12:42 AM, chalie ep

Re: [R] Generating and naming multiple time series

2009-08-05 Thread jim holtman
Here is one way: # use 'lapply' to generate your list of 'sets' sets <- lapply(1:100, function(x){ # create your set of data runif(100) # test data }) # put into matrix for 'matplot' # generates a very busy plot with 100 sets of data sets.m <- do.call(cbind, sets) matplot(sets.m, type='l'

Re: [R] problem with pattern matching

2009-08-05 Thread Rnewbie
I wanted to extract my interested rows from a dataframe. I used: grep(list$ID, dataframe$ID, value=T) #list contains a list of my interested IDs I got one match in return, which is the very first ID in list. It seems the matching process just stopped, once the first match was found. David Win

[R] Scientific Format E

2009-08-05 Thread Wittmer, Irene
Dear Helpers, I would like to export a large dataset to a txt file in order to use it in an other programm. Unfurtunatly the R the scientific format is a small e: 2 e-1 while the other programm requires the format to be a capital E: 2E-1 How can I change this in R? Thanks for your help PS

Re: [R] i'm so stuck with text file and contour plot

2009-08-05 Thread Jason Rupert
You can also try: readLines(...) This seems to be able to read in difficult txt files. Good luck. --- On Wed, 8/5/09, hannesPretorius wrote: > From: hannesPretorius > Subject: Re: [R] i'm so stuck with text file and contour plot > To: r-help@r-project.org > Date: Wednesday, August 5, 2009, 4

Re: [R] RE xcel Macro Mode

2009-08-05 Thread Tobias Verbeke
spencerg wrote: Have you looked at RExcel and the RExcelInstaller package? There is now a companion book: Heiberger and Neuwirth (2009) R Through Excel: A Spreadsheet Interface for Statistics, Data Analysis, and Graphics (Springer)? Both Amazon and the Springer web site say it's n

Re: [R] i'm so stuck with text file and contour plot

2009-08-05 Thread David Winsemius
What do you get with: count.fields(c:/small.txt', sep='\t', header=TRUE) On Aug 5, 2009, at 5:09 AM, hannesPretorius wrote: When I read the entire text file in I get the following message x <- read.table('c:/small.txt', sep='\t', header=TRUE) Warning message: number of items read is not a

[R] Lattice: change background of conditioning variable box

2009-08-05 Thread Alex van der Spek
For publication purposes I need to come up with B&W images (grey codes allowed). For normal R graphics this presents no problem. For lattice graphics, I can get everything B&W except for the box in which the conditioning variables are written per panel. I have searched the manuals but to no avail

Re: [R] regarding Rglpk loading

2009-08-05 Thread David Winsemius
On Aug 5, 2009, at 3:32 AM, Baidya Nath Mandal wrote: Hi everybody, I installed Rglpk package from local zip files. What files? What system? How installed? Then I tried to load the package in a R session. But R shows following message. Perhaps you did not install the dependencies? (The

Re: [R] RE xcel Macro Mode

2009-08-05 Thread spencerg
Have you looked at RExcel and the RExcelInstaller package? There is now a companion book: Heiberger and Neuwirth (2009) R Through Excel: A Spreadsheet Interface for Statistics, Data Analysis, and Graphics (Springer)? Both Amazon and the Springer web site say it's not yet availabl

Re: [R] R Excel

2009-08-05 Thread spencerg
Have you looked at Heiberger and Neuwirth (2009) R Through Excel: A Spreadsheet Interface for Statistics, Data Analysis, and Graphics (Springer)? Both Amazon and the Springer web site say it's not yet available. However, the Springer booth at the Joint Statistical Meetings was se

Re: [R] stepwise

2009-08-05 Thread David Winsemius
It's a bit of a puzzle to me that this has remained unanswered for 7 hours. Perhaps the readers who know the answers are reluctant to offer them because they have such low opinions of stepwise strategies but do not want to express such negativity. Or perhaps they thought that an RSiteSearch

Re: [R] i'm so stuck with text file and contour plot

2009-08-05 Thread Mark Difford
Hannes, >> When I read the entire text file in I get the following message Then you have not followed the very simple instructions I gave you above, which I repeat below. Or you have changed small.txt. ## TDat <- read.csv("small.txt", sep="\t") TDat str(TDat) Mark. hannesPretorius wrote: >

Re: [R] Durbin-Watson

2009-08-05 Thread Achim Zeileis
On Wed, 5 Aug 2009, Hardi wrote: Hi, I ran an experiment with 3 factors, 2 levels and 200 replications and as I want to test for residuals independence, I used Durbin-Watson in R. I found two functions (durbin.watson and dwtest) and while both are giving the same rho, the p-values are greatly

Re: [R] Build a dataframe row by row?

2009-08-05 Thread Gavin Simpson
On Wed, 2009-08-05 at 10:28 +1000, Remko Duursma wrote: > > Nice, but I need a few columns for the data. Don't know how to do this with > > the method you suggest. > > For each iteration, you make a vector of your 'data', in the example > it is a vector of length 3. > Each of the elements in this

Re: [R] Caculate first difference from a dataframe; write a simulation

2009-08-05 Thread Gavin Simpson
On Tue, 2009-08-04 at 23:42 +0530, Meenu Sahi wrote: > Dear R Users > > I'm writing my first simulation in R. > I've put across my problems with a smaller example in the attachment along > with the questions. Q1 - mydat4[, 1:2] is not a matrix! It is a data.frame. > class(mydat4[, 1:2]) [1] "dat

[R] Durbin-Watson

2009-08-05 Thread Hardi
Hi, I ran an experiment with 3 factors, 2 levels and 200 replications and as I want to test for residuals independence, I used Durbin-Watson in R. I found two functions (durbin.watson and dwtest) and while both are giving the same rho, the p-values are greatly differ: > durbin.watson(mod1) lag

Re: [R] fitted.values less than observed values

2009-08-05 Thread Gavin Simpson
On Tue, 2009-08-04 at 18:37 +0100, Federico Calboli wrote: > On 4 Aug 2009, at 18:27, David Winsemius wrote: > > > Your first posting made me think that you were complaining that the > > fitted values were less than the raw values. Your second posting makes > > me think that you may be conflating

Re: [R] Counting things

2009-08-05 Thread Gabor Grothendieck
Try this using built in data frame iris: > length(subset(iris, Sepal.Length >= 7, Sepal.Width)[[1]]) [1] 13 > length(subset(iris, Sepal.Length >= 7 & Species == 'virginica', > Sepal.Width)[[1]]) [1] 12 > # or the following (note that dot in Sepal.Length is automatically > # converted to _ becaus

[R] acf Significance

2009-08-05 Thread Steve Jones
Hi List, I'm trying to calculate the autocorrelation coefficients for a time series using acf at various lags. This is working well, and I can get the coefficients without any trouble. However, I don't seem to be able to obtain the significance of these coefficients from the returned acf object, l

[R] missing value in Elastic Net

2009-08-05 Thread ram basnet
Dear R users,    Does Elasticnet (package "elasticnet") handle the missing value in predictors ? If some one can provide the way to hadle missing value, it will great. Thanks in advance.   Sincerely, Ram Kumar Basnet Wageningen University, The Netherlands   [[alternative HTML ver

[R] overlap two graph

2009-08-05 Thread Hemavathi Ramulu
Hi everyone,I need you all help. I want to create few image in same diagram. For example, I wan draw two ellipse in same diagram. plot(ellipsePoints(2,5, alpha = 60), asp=1) and plot(ellipsePoints(2,5, alpha = 30), asp=1) How to display both ellipse together? both is different in angle. Thank

Re: [R] i'm so stuck with text file and contour plot

2009-08-05 Thread hannesPretorius
When I read the entire text file in I get the following message > x <- read.table('c:/small.txt', sep='\t', header=TRUE) Warning message: number of items read is not a multiple of the number of columns. thanks. hannesPretorius wrote: > > Ok i feel pretty stupid.. been trying to read a tex

[R] regarding Rglpk loading

2009-08-05 Thread Baidya Nath Mandal
Hi everybody, I installed Rglpk package from local zip files. Then I tried to load the package in a R session. But R shows following message. Loading required package: slam Error: package 'slam' could not be loaded In addition: Warning message: In library(pkg, character.only = TRUE, logical.retur

Re: [R] Stacked plots with common x-axis and different y-axis

2009-08-05 Thread Jim Lemon
Jason Rupert wrote: Is there a place that shows how to create two plots that are stacked on top of each other where they share a common x-axis scale, but have differnt y-axis scale? Say have the following data: airquality Stack plot(airquality$Day, airquality$Wind) on top of plot(airquality$D

[R] Decision boundaries for lda function?

2009-08-05 Thread Thomas Larsen
Hi, I am using the lda function from the MASS library. I would to find the decision boundaries of each class and subsequently plot them. I wonder if anybody can offer any help on this topic? Below I applied the lda function on a small dataset of mine. Any help will be much appreciated. > lib

[R] Double cross validation and prediction error

2009-08-05 Thread linda garcia
Dear all, I want to do double cross validation for example for Ridge regression/ lasso . One round of cross validation for optimising the parameter (lambda) and another round of cross validation for MSEP(Mean Square Error for Prediction). Any package which does it or some code?? T

[R] S4 method dispatch: coercion of arguments with setAs defined

2009-08-05 Thread Renaud Gaujoux
Hi list, I've got a class B that contains a slot obj of class A. I'd like to be able to call all the methods of class A directly on objects of class B as if I had called the method on slot obj. This without overloading all methods of class A to work on class B. I don't define B as an extension

Re: [R] read.csv from a remote machine

2009-08-05 Thread Olga Lyashevska
Thanks for your suggestions Mark, On 04.08.2009, at 19:16, Mark Wardle wrote: Alternatively, can't you copy the data to the Linux box using sftp first? This is perhaps the easiest option. I have established sftp connection. Now I simply add all files I need to use. So the problem is solve

[R] Austria, September, 2009: Statistical Learning and Data Mining Course

2009-08-05 Thread Trevor Hastie
Short course: Statistical Learning and Data Mining III: Ten Hot Ideas for Learning from Data Trevor Hastie and Robert Tibshirani, Stanford University Danube University Krems, Austria 25-26 September 2009 This two-day course gives a detailed overview of statistical models for data mining, infere

[R] Generating and naming multiple time series

2009-08-05 Thread Michael Nahasapeemapetilon
Hi, I am trying to generate 100 different random walks each containing 500 variables. The script I am using to develop one time series: > x <- w <- rnorm(500) > for (t in 2:500) x[t] <- x[t - 1] + w[t] >From here I become stuck as I would like to generate a series and name it Set1 for the first

Re: [R] lme funcion in R

2009-08-05 Thread ONKELINX, Thierry
Harry, I you use dummy variables, then you can only use (n-1) dummy variables if your variable has n levels. Otherwise you introduce multicollinearity! If you use n dummy variable then you can express one dummy variable as a linear combination of the others. Make use of a factor variable. That is

Re: [R] labeling in qplot

2009-08-05 Thread ONKELINX, Thierry
Dear Mo, This is rather easy. Add an ID to each data series, rbind them into one data.frame and use the colour argument of qplot. data1 <- data.frame(corArms = rnorm(1000)) data2 <- data.frame(corArms = rnorm(3000, sd = 0.5)) data3 <- data.frame(corArms = rnorm(2000, sd = 2)) data1$ID <- "Data

[R] feature weighting in randomForest

2009-08-05 Thread Häring, Tim (LWF)
Hello ! I´m using randomForest for classifacation problems. My dataset has 21.000 observations and 96 predictors. I know that some predictors of my dataset have more influence to classify my data than others. Therefore I would like to know if there is a way to weight my predictors. I know that

Re: [R] labeling in qplot

2009-08-05 Thread Nikos Alexandris
On Tue, 2009-08-04 at 20:16 -0700, Mohan S wrote: > HI > > am plotting different density plots in one graph each with a different > color. > > And i want to add labels to plot mentioning which color belongs to which > data series. > > p2 <- qplot(corArms, data = data1, geom = "density", adju

Re: [R] array slice notation?

2009-08-05 Thread Søren Højsgaard
Hi, 1) I think vector subscripting is faster than the solution below. 2) I don't understand the question, but it may be an idea to look at ?tableSlice and ?tableMargin in the gRbase package. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun..

<    1   2