[R] Indistinguishable balls into distinguishable boxes

2012-02-03 Thread Marc Girondot
Hi "the list" ! I would like to create a dataframe that answer to : "all the combinations of the different way to distribute n indistinguishable balls into k distinguishable boxes". Let take an example: 2 balls in 3 boxes: Box1 Box2 Box3 2 0 0 1 1 0 1 0 1 0

[R] effect function (effects package)

2012-02-03 Thread Hlavka, Eileen
Dear all, How does the effect() function in the effects package calculate effects and standard errors for glm quasipoisson models? I was using effect() to calculate the impact of increasing x to e + epsilon, and then finding the expected percent change. I thought that this effect (as a percen

Re: [R] Binding matrices of different sizes

2012-02-03 Thread chuck.01
http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=search_page&node=789695&query=cbind+with+different+rows Rambler1 wrote > > I am trying to bind two matrices of different length. They both are one > column and many rows but the rows differ by a few. How am I able to cbind > them toge

Re: [R] rpart: plot without scientific notation

2012-02-03 Thread Adalberto Pineda
Stephen: I tried running your script but couldn't make it work (any feedback is welcome) so I changed it a little bit. I found you still need to set the # of digits as the max # of possible digits of your yval response or greater. node.fun <- function(x) { x$frame$yval<-as.integer(sprintf("%0.f

Re: [R] combining data structures

2012-02-03 Thread Pete Brecknock
Not entirely sure why you would want a data.frame that has multiple entries in one of the columns (Connect.down) but leaving that aside is the following of any use? nn=list() nn[[1]] = list(Node = "1", Connect.up = c(NULL), Connect.down = c(2,3)) nn[[2]] = list(Node = "2", Connect.up = c(1)

Re: [R] X11 error while plotting in R on OSX

2012-02-03 Thread MacQueen, Don
I can't reproduce your error in R 2.14.1 on an OSX 10.6.8 box. However, your example doesn't start with a graphics device specification. Did you start the graphics device with x11() before your first plot() command? If by "R on a terminal" you mean in Terminal.app, then you wouldn't normally get

[R] R: sample size package

2012-02-03 Thread IOANNA
Hello, Lets assume I have an ordinal response variable representing the D<-c(D0,D1,D2,D3,D4) where D0 is no damage and D4 is collapse which I want to correlate with a continuous predictor variable, wind speed at the location of each building. is there a function in R which I can use to es

[R] combining data structures

2012-02-03 Thread David Stevens
Group It's unlikely I'm trying this the best way, but I'm trying to create a data structure from elements like nNode = 2 nn = vector("list",nNode) nn[[1]] = list(Node = "1", Connect.up = c(NULL), Connect.down = c(2,3)) nn[[2]] = list(Node = "2", Connect.up = c(1), Connect.down = c(4,5))

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread jim holtman
Exactly what does "crashed" mean? What was the error message? How you tried to put: rm(Lines) gc() at the end of the loop to free up and compact memory? If you watch the performance, does the R process seem to be growing in terms of the amount of memory that is being used? You can add: memor

Re: [R] SPATIAL QUESTION: HOW TO MAKE POLYGONS AROUND CLUSTERS OF POINTS AND EXTRACT AREAS AND COORDINATES OF THESE POLYGONS?

2012-02-03 Thread MacQueen, Don
I would suggest asking this question on r-sig-geo. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 2/3/12 6:59 AM, "Bjørn Økland" wrote: >Imagine that I have a large number of points (given by coordinates x and >y) that

Re: [R] how can i calculate the mean of my data which is only bigger than 75?

2012-02-03 Thread R. Michael Weylandt
If I understand you correctly, this is what I would do: rowsWeWant <- apply(dataframename, 1, function(x) any(x[, c("u", "v", "w1","w2")] > 75]) newDataFrame <- dataframename[rowsWeWant, ] colMeans(abs(newDataFrame)) I don't really use the subset function, but I imagine you could replace the firs

Re: [R] Reading table data from PDF files

2012-02-03 Thread jim holtman
I think a lot would depend on exactly how the data is formatted. I have used 'pdf2text' converters (many freely available on the web) to convert to text and then use R to read-in/preprocess the data to get it into a format to process. You can invoke these converter with the 'system' function and

Re: [R] Having trouble controlling plot() output (e.g., color)

2012-02-03 Thread Sarah Goslee
Hi David, You need to do some detective work. The data that gives an odd result: > str(bs_mean) 'data.frame': 13 obs. of 2 variables: $ month : Factor w/ 13 levels "2011_01","2011_02",..: 1 2 3 4 5 6 7 8 9 10 ... $ bs$log_t: num 1.2 1.28 1.31 1.35 1.37 ... A factor: no wonder it doesn't

Re: [R] If and apply?

2012-02-03 Thread R. Michael Weylandt
Try this: apply(gc2, 2, function(x) ifelse(x < 0.1*median(x), NA, x)} ifelse is the vectorized operation you are probably looking for. Michael On Fri, Feb 3, 2012 at 6:17 PM, wrote: > Hello, > > I'm trying to replace any value within a column where the value is less than > 10% of the median

Re: [R] If and apply?

2012-02-03 Thread David Winsemius
On Feb 3, 2012, at 6:17 PM, brann...@mskcc.org wrote: Hello, I'm trying to replace any value within a column where the value is less than 10% of the median of the column with NA. In other words, if the median of one column is 500, any value in that column that is less than 50 should bec

[R] Simulating from "matrix variate normal distribution"

2012-02-03 Thread Shantanu MULLICK
Hello everyone Is there a function/command to simulate from "matrix variate normal distribution" in R. A follow up question would be is there a function/command to obtain the density, distribution and quantile function of "matrix variate normal distribution" in R. Wikipedia has a good descriptio

[R] Having trouble controlling plot() output (e.g., color)

2012-02-03 Thread David Wolfskill
I expect that there's something glaringly obvious that I'm overlooking, as I'm justr getting back involved in using R after a several-month hiatus (from R). So I welcome clues. When I invoke plot(), merely specifying a data.frame with 2 columns, specify the plot type ("type") of "p" ("points"), a

[R] If and apply?

2012-02-03 Thread brannona
Hello, I'm trying to replace any value within a column where the value is less than 10% of the median of the column with NA. In other words, if the median of one column is 500, any value in that column that is less than 50 should become NA. Doing a lot of searches, it seems like I should be us

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread peter dalgaard
On Feb 3, 2012, at 18:03 , G See wrote: > On Fri, Feb 3, 2012 at 10:39 AM, peter dalgaard wrote: >> >> So that's a nonbreak space alright. Next question: How did it get there? I'm >> mildly surprised that it crept into the data frame, I would expect it to >> happen much easier with things typ

Re: [R] ordering of factor levels in regression changes result

2012-02-03 Thread David Winsemius
On Feb 3, 2012, at 4:16 PM, Tulinsky, Thomas wrote: I was surprised to find that just changing the base level of a factor variable changed the number of significant coefficients in the solution. I was surprised at this and want to know how I should choose the order of the factors, if the

[R] ordering of factor levels in regression changes result

2012-02-03 Thread Tulinsky, Thomas
I was surprised to find that just changing the base level of a factor variable changed the number of significant coefficients in the solution. I was surprised at this and want to know how I should choose the order of the factors, if the order affects the result. Here is the small example. It is

Re: [R] [fields] image.plot abends with NAs in image.plot.info

2012-02-03 Thread Doug Nychka
Tom, Before we go into this in detail can you double check that your second data image is OK. Just try something like image( z) where z is the matrix of values for the second image. ( the $z component of an image list) My quick guess is that the second image is all NAs due to a few missing

Re: [R] Hanging -- please help decipher event report

2012-02-03 Thread jeremyd
Thanks for your reply. At line 144 I call R_CheckUserInterrupt(). I added this because otherwise, R would not respond to the user for thing like switching over to the window until the C code exited back to R. I then moved that command into a loop where it should occur quite frequently, because I th

[R] zeroinfl package - Year effect and precision

2012-02-03 Thread Lee, Laura
Hello. I am using the zeroinfl package to fit a zero-inflated negative binomial. The explanatory variables are Year and Depth x STemp (interaction). I am in need of guidance for extracting the year effect and the associated precision. Thank you for your time. Cheers, Laura

Re: [R] incomplete final line found on

2012-02-03 Thread Dimitri Liakhovitski
Thank you, Michael - it worked - it was exactly what I was looking for. Thank you, David - I added the link to my toolbar - and sorry, you are right, I should have searched more. Dimitri On Fri, Feb 3, 2012 at 4:52 PM, David Winsemius wrote: > Dimitri. > > This has been asked a whole bunch of tim

Re: [R] incomplete final line found on

2012-02-03 Thread David Winsemius
Dimitri. This has been asked a whole bunch of times on this list. Do a search on the text in the error message if you doubt me. I have this link on my toolbar: R-search: http://search.r-project.org/cgi-bin/namazu.cgi?query=&max=100&result=normal&sort=score&idxname=Rhelp10&idxname=Rhelp08&id

Re: [R] GAM (mgcv) warning: matrix not positive definite

2012-02-03 Thread Simon Wood
It is completely safe to ignore this. Here is what is going on... mgcv routine 'mroot' is calling R routine 'chol' to find the *pivoted* Choleski factor of a positive semi definite matrix. This is deliberate, and completely ok to do, but 'chol' issues a warning when a matrix is only positive s

Re: [R] incomplete final line found on

2012-02-03 Thread R. Michael Weylandt
Try opening the file up in a text editor and inserting a blank line or two on the end. (There's either an EOL or EOF character missing and this trick usually works for me -- never sure why/when it happens though) Michael On Fri, Feb 3, 2012 at 4:23 PM, Dimitri Liakhovitski wrote: > Dear R-ers, >

[R] incomplete final line found on

2012-02-03 Thread Dimitri Liakhovitski
Dear R-ers, I hope there is a really simple solution to my problem. I've written a function that I saved in an .r file. I source this file in my code. For a while it worked fine. But then when I run the line: source("F mylineplot.r") I started getting a warning: In readLines(file) : incomplete f

Re: [R] Fiedler

2012-02-03 Thread Kjetil Halvorsen
Hola! This can be done with the CRAN package igraph, which contains (part of) the arpack library for computing only some eigenvalues/eigenvectors of sparse matrices. arpack gives you the option of computing a few of the smallest or a few of the largest eigenvalues/vectors. Do library(igraph) ?arp

Re: [R] Clear last x entries of R console

2012-02-03 Thread 538280
You may want to look at functions like: txtProgressBar, winProgressBar (windows onnly), or tkProgressBar (tcltk package), rather than reinventing the wheel. On Fri, Feb 3, 2012 at 7:00 AM, angliski_jigit wrote: > Hi All, > > I am trying to build in a progress-tracker into my loops that let me hav

[R] Reading table data from PDF files

2012-02-03 Thread Bryan McCloskey
All, Is anyone familiar with a way to use R to read table data from a large collection of PDF files? I'm aware there are various command lines and desktop utilities that might be able to (e.g.,) dump PDFs to text, which could then be parsed for table data. But I'm hoping there is something more

[R] GAM (mgcv) warning: matrix not positive definite

2012-02-03 Thread Arnaud Mosnier
Dear list, I fitted the same GAM model using directly the function gam(mgcv) ... then as a parameter of another function that capture the warnings messages (see below). In the first case, there is no warning message printed, but in the last one, the function find two warning messages stating "mat

Re: [R] Fail to install odfWeave

2012-02-03 Thread David Winsemius
On Feb 3, 2012, at 3:28 PM, istarninwa wrote: Hi all, I am trying to install odfWeave package and get the following error: ### install.packages('odfWeave') Warning message: In getDependencies(pkgs, dependencies, available, lib) : package 'odfWeave' i

Re: [R] Using {tabularx} latex package with the {xtable} package?

2012-02-03 Thread David Winsemius
On Feb 3, 2012, at 2:54 PM, Tal Galili wrote: I am trying to solve the problem of having a latex table (produced using the xtable , then inserted to a latex file using Sweave), exceeding the margins of my LaTeX document. I found t

[R] Fail to install odfWeave

2012-02-03 Thread istarninwa
Hi all, I am trying to install odfWeave package and get the following error: ### > install.packages('odfWeave') Warning message: In getDependencies(pkgs, dependencies, available, lib) : package 'odfWeave' is not available (for R version 2.14.1) ##

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread HC
Bad news! The readLines command works fine upto a certain limit. Once a few files have been written the R program crashes. I used the following code: * iFile<-"Test.txt" con <- file(iFile, "r") N<-125; iLoop<-1 while(length(Lines <- readLines(con, n = N)) > 0 & iLo

Re: [R] Hanging -- please help decipher event report

2012-02-03 Thread Duncan Murdoch
On 03/02/2012 11:53 AM, jeremyd wrote: I'm running some code in R64 on a Mac OS 10.6.8 that calls a C program through the dyn.load() function. The code hangs after several days of computation, and I've having trouble locating the problem. Can anyone decipher this info from the error report, and t

[R] Using {tabularx} latex package with the {xtable} package?

2012-02-03 Thread Tal Galili
I am trying to solve the problem of having a latex table (produced using the xtable , then inserted to a latex file using Sweave), exceeding the margins of my LaTeX document. I found that one such solution can be based on the tabularx

Re: [R] ggplot theme_update

2012-02-03 Thread vd3000
Hi, David, Thanks a lot. I don't know how it works after adding the line after library(ggplot2) /base_theme <- theme_update(axis.text.x = theme_text(angle = 0, hjust = 0.5), axis.text.y = theme_text(angle = 0, hjust = 0.5), panel.grid.major = theme_line(colour = "grey90"), panel.grid.minor = th

Re: [R] sapply help

2012-02-03 Thread Filoche
Thank you sire. You explained it very well. This give ma a good point to start using sapply more frequently. Cordially, Phil -- View this message in context: http://r.789695.n4.nabble.com/sapply-help-tp4355092p4355376.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread HC
Thank you. The readLines command is working fine and I am able to read 10^6 lines in one go and write them using the write.table command. Does this readLines command using a block concept to optimize or goes line by line? Steve has mentioned about *nix and split commands. Would there be any spee

[R] Hanging -- please help decipher event report

2012-02-03 Thread jeremyd
I'm running some code in R64 on a Mac OS 10.6.8 that calls a C program through the dyn.load() function. The code hangs after several days of computation, and I've having trouble locating the problem. Can anyone decipher this info from the error report, and tell me if this is a problem in R64, or in

Re: [R] creating R package

2012-02-03 Thread J Toll
On Fri, Feb 3, 2012 at 11:25 AM, ql16717 wrote: > Hi, > > I never acutally made a package before. I have a folder, say called > "john" that has everything it needs to be in a R package. Some > instruction says I need Rtools from R mirror site. I installed the > Rtools, but under DOS, the command "

Re: [R] sapply help

2012-02-03 Thread William Dunlap
Instead of colSums(t(aMatrix)), why not the more direct rowSums(aMatrix)? If time is an issue (which it won't be unless the number of columns of M is big), compare: > M <- matrix(2e5:1, nrow=2) > v <- 1:ncol(M) > system.time(z1 <- sapply(seq_along(v), function(i) sum(M[,i] < v[i]))) use

Re: [R] an unusual use for R

2012-02-03 Thread 538280
Nice, Last year I found that my office needed some decoration and my wife has some fancy sewing machines that can be programmed to do embroidery and cross-stitch. So I designed some cross stitches (using R and the program for the machines) that show distribution functions and equations for the Ce

Re: [R] aggregate arrays

2012-02-03 Thread David Winsemius
On Feb 3, 2012, at 11:45 AM, Leuzinger Sebastian wrote: Dear list after quite a bit of research in the archive, I gave up. This seems to be a simple problem: I would like to aggregate a (3-dimensional) array, either by another array, or by a vector, indicating the dimension which should

Re: [R] ggplot theme_update

2012-02-03 Thread David Winsemius
On Feb 3, 2012, at 10:14 AM, ONKELINX, Thierry wrote: Hi Nameless, You would have to add your code to the source of the ggplot2 package to make it permanent. But that not a vary good idea. Just add the line to your script and rerun it when you restart your analysis. Or add it ( afte

Re: [R] sapply help

2012-02-03 Thread Milan Bouchet-Valat
Le vendredi 03 février 2012 à 18:27 +0100, Ernest Adrogué a écrit : > 3-02-2012, 08:37 (-0800); Filoche escriu: > > Hi every one. > > > > I'm learning how to use sapply (and other function of this family). > > > > Here's what I'm trying to do. > > > > I have a vector of lets say 5 elements. I al

Re: [R] sapply help

2012-02-03 Thread Ernest Adrogué
3-02-2012, 08:37 (-0800); Filoche escriu: > Hi every one. > > I'm learning how to use sapply (and other function of this family). > > Here's what I'm trying to do. > > I have a vector of lets say 5 elements. I also have a matrix of nX5. I would > like to know how many element by column are infe

[R] creating R package

2012-02-03 Thread ql16717
Hi, I never acutally made a package before. I have a folder, say called "john" that has everything it needs to be in a R package. Some instruction says I need Rtools from R mirror site. I installed the Rtools, but under DOS, the command "Rcmd" is still not recognized. Any suggestions? Thanks John

[R] Scaling in optimization

2012-02-03 Thread John C Nash
Ben Bolker pointed out in a response about max. likelihood estimation that parameter scaling is not available in nlminb On 02/03/2012 06:00 AM, r-help-requ...@r-project.org wrote: > * if you were using one of the optimizing methods from optim() (rather > than nlminb), e.g. L-BFGS-B, I would sugg

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
On Fri, Feb 3, 2012 at 10:39 AM, peter dalgaard wrote: > > So that's a nonbreak space alright. Next question: How did it get there? I'm > mildly surprised that it crept into the data frame, I would expect it to > happen much easier with things typed on the keyboard (Alt-Spc on my Mac > keyboard

[R] aggregate arrays

2012-02-03 Thread Leuzinger Sebastian
Dear list after quite a bit of research in the archive, I gave up. This seems to be a simple problem: I would like to aggregate a (3-dimensional) array, either by another array, or by a vector, indicating the dimension which should be aggregated. I don't think I have to provide an example, it

[R] sapply help

2012-02-03 Thread Filoche
Hi every one. I'm learning how to use sapply (and other function of this family). Here's what I'm trying to do. I have a vector of lets say 5 elements. I also have a matrix of nX5. I would like to know how many element by column are inferior to each element of my vector. On this example: v = c(

Re: [R] Uploading into R

2012-02-03 Thread carlb1
Thank you very much its appreciated -- View this message in context: http://r.789695.n4.nabble.com/Uploading-into-R-tp4354538p4354960.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.

[R] Flexmix new data classification

2012-02-03 Thread loyolite270
hi I built a flexmix GLM binomial model with 200 observations and the model gave me 2 clusters, so if the model is named as newModel then i get the cluster index for each row using newModel@clusters. Now is there any way to predict which cluster the new observation or 201 observation belongs to u

Re: [R] Clear last x entries of R console

2012-02-03 Thread angliski_jigit
Thanks! I had a quick play with cat() in the command line (e.g. typing cat(".")) and didn't seem to help because it just sent me to a new line; I see now that when put into a script though cat() is all you need. Thanks, AJ -- View this message in context: http://r.789695.n4.nabble.com/Clear-last

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread peter dalgaard
On Feb 3, 2012, at 17:23 , G See wrote: > Thank you Duncan, that is very helpful. > > Although I think we've got it sorted out now, to answer your previous > questions, it is repeatable in a new R session, and the output of > charToRaw is below. > > On Ubuntu, I get the following: >> charToRaw

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread Petr Savicky
On Fri, Feb 03, 2012 at 10:10:56AM -0600, G See wrote: > Sorry, I meant > Do you know of a way to print a string such that I can see whether it > contains a *space* or a no-break space? Hi. For unknown characters, the following may be useful x <- "n/a " library(Unicode) u_char_inspect(as.

Re: [R] iterating through for loop

2012-02-03 Thread William Dunlap
Use a common subscript to go through two or more objects in parallel: > x<-c(1,2,4,7,34,6) > y<-c(3,5,6,9,34,7) > stopifnot(length(x)==length(y)) > for(i in seq_along(x)) { +print(paste(x[i], y[i])) + } [1] "1 3" [1] "2 5" [1] "4 6" [1] "7 9" [1] "34 34" [1] "6 7" For t

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread Duncan Murdoch
On 12-02-03 11:10 AM, G See wrote: Sorry, I meant Do you know of a way to print a string such that I can see whether it contains a *space* or a no-break space? Use tools::showNonASCII(x). On Petr's example, it gives 1: n/a Duncan Murdoch On Fri, Feb 3, 2012 at 10:10 AM, G See wrote: Pe

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
Thank you Duncan, that is very helpful. Although I think we've got it sorted out now, to answer your previous questions, it is repeatable in a new R session, and the output of charToRaw is below. On Ubuntu, I get the following: > charToRaw(x) [1] 6e 2f 61 c2 a0 On Mac, I get: > charToRaw(x) [1]

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread Duncan Murdoch
On 12-02-03 10:25 AM, G See wrote: I have a data.frame named "df". The dput of df is at the bottom of this e-mail. What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works to do this: df[df == "n/a"]<- NA However, it does not work on Ubuntu. See below. Thanks in advance,

[R] [fields] image.plot abends with NAs in image.plot.info

2012-02-03 Thread Tom Roche
summary: image.plot-ing two sets of netCDF data, with the second derived from the first. First plots to PDF as expected (title, data, legend). Second plots the data and title, but abends before drawing the legend, with > Error in if (del == 0 && to == 0) return(to) : > missing value where TRUE

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
Sorry, I meant Do you know of a way to print a string such that I can see whether it contains a *space* or a no-break space? On Fri, Feb 3, 2012 at 10:10 AM, G See wrote: > Petr, > > Thank you!  That is great. > > Do you know of a way to print a string such that I can see whether it > contains a

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
Petr, Thank you! That is great. Do you know of a way to print a string such that I can see whether it contains a string or a no-break space? Thanks, Garrett On Fri, Feb 3, 2012 at 10:01 AM, Petr Savicky wrote: > On Fri, Feb 03, 2012 at 09:25:10AM -0600, G See wrote: >> I have a data.frame nam

Re: [R] How to use a sequence of covariates in linear model (lm)?

2012-02-03 Thread Joshua Wiley
Or pass the covariates as a matrix. See ?lm for details. On Feb 3, 2012, at 7:51, "R. Michael Weylandt" wrote: > Usually that's what the dot in a formula is used for. > > E.g., > > data(iris) > str(iris) > lm(Petal.Width ~ ., data = iris) > > Michael > > On Fri, Feb 3, 2012 at 10:45 AM, mi

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
Hi Sarah, Thank you very much for the response. In fact, it does work on Mac even without including the space: > Symbol <- "GOOG" > require(XML) Loading required package: XML > URL <- paste("http://earnings.com/company.asp?client=cb&ticker=";, Symbol, > sep="") > x <- readHTMLTable(URL, str

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread Petr Savicky
On Fri, Feb 03, 2012 at 09:25:10AM -0600, G See wrote: > I have a data.frame named "df". The dput of df is at the bottom of this > e-mail. > What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it > works > to do this: > df[df == "n/a"] <- NA > > However, it does not work on Ub

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread Sarah Goslee
Is that exactly what you're doing, in a clean session? x <- rdata[27, 4] > x == "n/a " [1] TRUE > x == "n/a" [1] FALSE Because as long as the space is included, the test should be TRUE. (I renamed the dput object rdata, because df() is a base function.) df[df == "n/a"] <- NA shouldn't work on

Re: [R] How to use a sequence of covariates in linear model (lm)?

2012-02-03 Thread R. Michael Weylandt
Usually that's what the dot in a formula is used for. E.g., data(iris) str(iris) lm(Petal.Width ~ ., data = iris) Michael On Fri, Feb 3, 2012 at 10:45 AM, michael wrote: > I have a high dimension linear model: > > y~ x1 + x2 + ... + x_n.  n is very large. > > For linear model fit, I wish to us

[R] How to use a sequence of covariates in linear model (lm)?

2012-02-03 Thread michael
I have a high dimension linear model: y~ x1 + x2 + ... + x_n. n is very large. For linear model fit, I wish to use a sequence of covariates, say X1 to X200, without typing every single covariate in the function (my variable names are coded in the pattern of X1, X2, ...). I think all.var or all.n

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread Gabor Grothendieck
On Fri, Feb 3, 2012 at 8:08 AM, HC wrote: > This is a 160 GB tab-separated .txt file. It has 9 columns and 3.25x10^9 > rows. > > Can R handle it? > You can process a file N lines at time like this: con <- file("myfile.dat", "r") while(length(Lines <- readLines(con, n = N)) > 0) { ... whatever.

[R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
I have a data.frame named "df". The dput of df is at the bottom of this e-mail. What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works to do this: df[df == "n/a"] <- NA However, it does not work on Ubuntu. See below. Thanks in advance, Garrett > x <- df[27, 4] # complet

Re: [R] Uploading into R

2012-02-03 Thread Duncan Murdoch
On 12-02-03 8:00 AM, carlb1 wrote: Hi I am just starting out in R and im trying to upload some data into it. I have saved a small file from excel as a .txt file in the working directory i am using in a folder of the same name as the .txt file. When i write the function to open it I keep getting

Re: [R] Memory leaks in .C-interface

2012-02-03 Thread Duncan Murdoch
On 12-02-03 9:26 AM, Grigory Alexandrovich wrote: Hi, I wrote a C-function which I call with the .C-interface ( something like .C("foo", x, y) ). The function does a lot of things. Amongst other things it allocates much memor

Re: [R] Clear last x entries of R console

2012-02-03 Thread Duncan Murdoch
On 12-02-03 9:00 AM, angliski_jigit wrote: Hi All, I am trying to build in a progress-tracker into my loops that let me have a sense of their progress. I'd like to be able to output to screen a series of periods "" etc. for each completion of the loop, but I want to build a pyramid, e.g. .

[R] SPATIAL QUESTION: HOW TO MAKE POLYGONS AROUND CLUSTERS OF POINTS AND EXTRACT AREAS AND COORDINATES OF THESE POLYGONS?

2012-02-03 Thread Bjørn Økland
Imagine that I have a large number of points (given by coordinates x and y) that vary in density per space. For the purpose of demonstration it could be generated like this: s <- data.frame(x=runif(1,0,900),y=runif(1,0,900)); plot(s) I want to create polygons around the points where poi

Re: [R] ggplot theme_update

2012-02-03 Thread ONKELINX, Thierry
Hi Nameless, You would have to add your code to the source of the ggplot2 package to make it permanent. But that not a vary good idea. Just add the line to your script and rerun it when you restart your analysis. Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research I

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread HC
This is a 160 GB tab-separated .txt file. It has 9 columns and 3.25x10^9 rows. Can R handle it? Thank you. HC -- View this message in context: http://r.789695.n4.nabble.com/sqldf-for-Very-Large-Tab-Delimited-Files-tp4350555p4354556.html Sent from the R help mailing list archive at Nabble.co

[R] Uploading into R

2012-02-03 Thread carlb1
Hi I am just starting out in R and im trying to upload some data into it. I have saved a small file from excel as a .txt file in the working directory i am using in a folder of the same name as the .txt file. When i write the function to open it I keep getting this message > snow<-read.table("w

Re: [R] how to plot several curves in the same frame

2012-02-03 Thread ikuzar
Ok. I really have 15 days to plot, the x-axis is the date, and it is going to the MINUTES in a day. I have to plot a curve per day (so 15 plots) The real data is like this: 2012-02-01 00:01:00; 2100 2012-02-01 02:02:00; 2200 ... 2012-02-15 23:58:00; 2400 2012-02-15 23:59:00; 2400 -- View t

[R] Memory leaks in .C-interface

2012-02-03 Thread Grigory Alexandrovich
Hi, I wrote a C-function which I call with the .C-interface ( something like .C("foo", x, y) ). The function does a lot of things. Amongst other things it allocates much memory (stack and heap). Every heap allocation (with m

[R] Clear last x entries of R console

2012-02-03 Thread angliski_jigit
Hi All, I am trying to build in a progress-tracker into my loops that let me have a sense of their progress. I'd like to be able to output to screen a series of periods "" etc. for each completion of the loop, but I want to build a pyramid, e.g. . .. ... etc. So I need to be able to dele

[R] ode() tries to allocate an absurd amount of memory

2012-02-03 Thread Thomas Brown
Hi there R-helpers: I'm having problems with the function ode() found in the package deSolve. It seems that when my state variables are too numerous (>33000 elements), the function throws the following error: Error in vode(y, times, func, parms, ...) : cannot allocate memory block of size 13743

Re: [R] strftime - Dates from Excel files

2012-02-03 Thread Mikko Korpela
On 02/03/2012 03:34 PM, Ana wrote: > Hi > > I have many excel files were the Date field was not declared as date, > so the dates look like this: 1/2/1978 > I know that the format is day/month/year > > How can I make R change this to Date format? > > If I use strftime, I get wrong dates: > > dat

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Johannes Radinger
hi, Original-Nachricht > Datum: Fri, 3 Feb 2012 09:04:19 -0500 > Von: Steve Lianoglou > An: Johannes Radinger > CC: Joshua Wiley , r-help@r-project.org > Betreff: Re: [R] Assigning objects to variable and variable to list in a for > loop > Hi, > > On Fri, Feb 3, 2012 at 8:00

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Steve Lianoglou
Hi, On Fri, Feb 3, 2012 at 8:00 AM, Johannes Radinger wrote: > Hello, > > I tried to use the lapply approach, but I am not sure how to > se it correctly for my task. Here I just want to give an short > script which explains how my data structure looks like. It also > contains the second approach

Re: [R] strftime - Dates from Excel files

2012-02-03 Thread Prof Brian Ripley
On Fri, 3 Feb 2012, Ana wrote: Hi I have many excel files were the Date field was not declared as date, so the dates look like this: 1/2/1978 I know that the format is day/month/year How can I make R change this to Date format? If I use strftime, I get wrong dates: So use as.Date to convert

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread Steve Lianoglou
On Fri, Feb 3, 2012 at 7:37 AM, Gabor Grothendieck wrote: > On Fri, Feb 3, 2012 at 6:03 AM, HC wrote: >> Thank you for indicating that SQLite may not handle a file as big as 160 GB. >> >> Would you know of any utility for *physically splitting *the 160 GB text >> file into pieces. And if one can

[R] strftime - Dates from Excel files

2012-02-03 Thread Ana
Hi I have many excel files were the Date field was not declared as date, so the dates look like this: 1/2/1978 I know that the format is day/month/year How can I make R change this to Date format? If I use strftime, I get wrong dates: dataset=c("1/2/1978") strftime(dataset,"%d/%m/%Y") "19/02/0

Re: [R] possibly Error in R version 2.12.1 (2010-12-16)

2012-02-03 Thread peter dalgaard
On Feb 2, 2012, at 21:24 , Frank Schwidom wrote: > Hi, > > the following Code demonstrates an possibly Error in R > (or you can explain me, why this happens, thanks in advance) Looks like an effect of lazy evaluation: The value of i is not evaluated until after the loop has ended, at which po

Re: [R] Assigning objects to variable and variable to list in a for loop

2012-02-03 Thread Johannes Radinger
Hello, I tried to use the lapply approach, but I am not sure how to se it correctly for my task. Here I just want to give an short script which explains how my data structure looks like. It also contains the second approach with a for loop which is working but there is the question of how assinin

Re: [R] iterating through for loop

2012-02-03 Thread Petr PIKAL
Hi > [R] iterating through for loop > > how to iterate two elements each through for loop? > e.g. x<-c(1,2,4,7,34,6) > y<-c(3,5,6,9,34,7) > > for(z in x){ > print(paste(z,y)) } > > > i want both element of vector iterate serially with same position Not sure what the result shall be. but pas

Re: [R] how to plot several curves in the same frame

2012-02-03 Thread Gabor Grothendieck
On Fri, Feb 3, 2012 at 5:05 AM, ikuzar wrote: > Hello, > I'd like to know how to plot several curves in the same frame (1curve = > 1line=1day). > For instance (csv file): > > 2012-02-01 01:00:00; 2100 > 2012-02-01 02:00:00; 2200 > ... > 2012-02-01 23:00:00; 2500 > 2012-02-02 01:00:00; 1000 > 2012-

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-03 Thread Gabor Grothendieck
On Fri, Feb 3, 2012 at 6:03 AM, HC wrote: > Thank you for indicating that SQLite may not handle a file as big as 160 GB. > > Would you know of any utility for *physically splitting *the 160 GB text > file into pieces. And if one can control the splitting at the  end of a > record. > If they are c

[R] newly install old and present R versions

2012-02-03 Thread Thomas Mang
Hi, Moving to a new computer (Windows 7) but for reasons of reproduceability I would seriously like to also install my present R 2.8.1 along with all extension packages on that machine as well (that is besides R 2.14.1). What's the best way of doing so? My idea is: Get the setup for 2.8.1 an

Re: [R] replicate rows

2012-02-03 Thread Petr PIKAL
Hi> > Hello, > > I have a matrix of 17 rows and 20 columns. I want to replicate this matrix > 20 times, but I only want to replicate the rows. How do I do that? Replicate index. x<-matrix(1:4, 2,2) x[rep(1:2, 20),] Regards Petr > > Kind regards / Met vriendelijke groet / Med venlig hilsen, >

Re: [R] how to plot several curves in the same frame

2012-02-03 Thread jim holtman
Your data appears to have two different dates. What is the x-axis of the data you want plotted? Is it just going to the the hours in a day? On Fri, Feb 3, 2012 at 5:05 AM, ikuzar wrote: > Hello, > I'd like to know how to plot several curves in the same frame (1curve = > 1line=1day). > For insta

  1   2   >