Re: [R] :How to insert a column in a data frame

2009-02-17 Thread Rolf Turner
On 18/02/2009, at 12:51 PM, Laura Rodriguez Murillo wrote: Hi dear list, I wonder if somebody can help me with this. I have a text file with 300 rows and around 30 columns and I need to insert a column that has the number 1 in every row. This new column should be placed between columns 6

Re: [R] ylim in plot.ts?

2009-02-17 Thread Gabor Grothendieck
Check out: https://www.stat.math.ethz.ch/pipermail/r-help/2009-February/187562.html On Tue, Feb 17, 2009 at 6:45 PM, Oliver Bandel oli...@first.in-berlin.de wrote: Hello, I tried to use ylim=c(x,y) in a plot.ts(). This was ignored. How can I achieve it to create such graphics? Ciao,

[R] how to randomly eliminate half the entries in a vector?

2009-02-17 Thread Esmail Bonakdarian
Hello all, I need some help with a nice R-idiomatic and efficient solution to a small problem. Essentially, I am trying to eliminate randomly half of the entries in a vector that contains index values into some other vectors. More details: I am working with two strings/vectors of 0s and 1s.

[R] FW: Can't access CRAN

2009-02-17 Thread Charles Annis, P.E.
Dear R-Helpers: I'm running R version 2.8.1 on a 1 year old HP Pavilion with a AMD Athelon 64 Dual Core Processor 4800+ 2.50GHz chip, Vista Home Premium SP1, and 2 GB RAM. I can't add packages (even running as Administrator) because I can't connect to a CRAN mirror. chooseCRANmirror() (After

Re: [R] cumsum vs. sum

2009-02-17 Thread Gabor Grothendieck
Check out sum.exact and cumsum.exact in the caTools package. library(caTools) Loading required package: bitops x - 1/(12:14) sum(x) - cumsum(x)[3] [1] 2.775558e-17 sum.exact(x) - cumsum.exact(x)[3] [1] 0 On Tue, Feb 17, 2009 at 5:12 PM, Stavros Macrakis macra...@alum.mit.edu wrote: I

Re: [R] how to randomly eliminate half the entries in a vector?

2009-02-17 Thread Jeremiah Rounds
Here is what I got for script through your third question: set.seed(1) x1 = rbinom(200,1,.5) x2 = rbinom(200,1,.5) differ = x1 != x2 differ.indexes = (1:length(x1))[differ == TRUE] #you were unclear if you want to round up or round down on odd index of differ.indexes n = floor(

[R] rbind: number of columns of result is not a multiple of vector length (arg 1)

2009-02-17 Thread CJ Rubio
i have the following constructed and running very well,, thanks to Gabor Grothendieck for his help. data.info - c(station.id, year, date, max.discharge) for(i in 1:num.files) { + station.id - substring(data[i], 1,8) + DF - read.table(data[i], sep=,, blank.lines.skip = TRUE) + z - zoo(DF[,4],

Re: [R] Help with rgl

2009-02-17 Thread Yihui Xie
(1) you'll need ImageMagick installed to use the command convert to convert image sequences into GIF animations; see ?movie3d (2) viewport is read only!! see ?open3d carefully Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877

Re: [R] rbind: number of columns of result is not a multiple of vector length (arg 1)

2009-02-17 Thread jim holtman
try using: data.info - rbind(data.info, cbind(station.id, year, date, max.discharge)) On Tue, Feb 17, 2009 at 9:26 PM, CJ Rubio cjru...@kongju.ac.kr wrote: i have the following constructed and running very well,, thanks to Gabor Grothendieck for his help. data.info - c(station.id, year,

Re: [R] rbind: number of columns of result is not a multiple of vector length (arg 1)

2009-02-17 Thread CJ Rubio
it works perfectly thank you for your help what if i want to seperate each stations data and save in a .csv file?? while i'm asking you these i'm also finding some ways to do so.. thank you again. jholtman wrote: try using: data.info - rbind(data.info, cbind(station.id, year,

[R] how to randomly eliminate half the entries in a vector?

2009-02-17 Thread Esmail Bonakdarian
(sorry if this is a duplicate-problems with posting at my end) Hello all, I need some help with a nice R-idiomatic and efficient solution to a small problem. Essentially, I am trying to eliminate randomly half of the entries in a vector that contains index values into some other vectors.

Re: [R] rbind: number of columns of result is not a multiple of vector length (arg 1)

2009-02-17 Thread jim holtman
You could 'split' the dataframe and then write out each element: something like x - split(data.info, data.info$station.id) for (i in names(x)) write.csv(x[[i]], file=paste(i, .csv, sep=)) On Tue, Feb 17, 2009 at 10:11 PM, CJ Rubio cjru...@kongju.ac.kr wrote: it works perfectly thank you

Re: [R] how to randomly eliminate half the entries in a vector?

2009-02-17 Thread Gene Leynes
This is my first help post, hope it works! Just check out the sample function At the command line type: ?sample I think it will be pretty clear from the documentation. On Tue, Feb 17, 2009 at 9:13 PM, Esmail Bonakdarian esmail...@gmail.comwrote: (sorry if this is a duplicate-problems with

Re: [R] how to randomly eliminate half the entries in a vector?

2009-02-17 Thread Esmail Bonakdarian
Gene Leynes wrote: This is my first help post, hope it works! Just check out the sample function At the command line type: ?sample I think it will be pretty clear from the documentation. Yes, most excellent suggestion and quite helpful! Thanks, Esmail

Re: [R] FW: Can't access CRAN

2009-02-17 Thread Gabor Grothendieck
Maybe the suggestions here help: http://cran.r-project.org/bin/windows/base/rw-FAQ.html#The-Internet-download-functions-fail_002e On Tue, Feb 17, 2009 at 8:19 PM, Charles Annis, P.E. charles.an...@statisticalengineering.com wrote: Dear R-Helpers: I'm running R version 2.8.1 on a 1 year old HP

Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009

2009-02-17 Thread Paul Heinrich Dietrich
Hi Uwe, Thank you for your guidance. I have installed R2WinBUGS and WinBUGS14 under wine. Using ?bugs for help, it tells me: useWINE: logical; attempt to use the Wine emulator to run 'WinBUGS', defaults to 'FALSE' on Windows, and 'TRUE' otherwise. Not available in S-PLUS. WINE: character,

Re: [R] Help with rgl

2009-02-17 Thread roger koenker
Why I love R [Number 6]: Chinese extend a helping hand to Russians who happen to be in Brazil about a package written in Germany. Trotsky would be proud -- and amazed! url:www.econ.uiuc.edu/~rogerRoger Koenker email rkoen...@uiuc.edu

[R] Plotting Binned Data

2009-02-17 Thread Gundala Viswanath
Dear all, I have a binned data that looks like this: dat (-1,9] (9,19] (19,29] (29,39] (39,49] (49,59] (59,69] (69,79] 10063374 79 1643443 (79,89] (89,99] 62 I tried to plot a histogram overlayed with curve. With

Re: [R] Help with rgl

2009-02-17 Thread Yihui Xie
Chinese extend a helping hand to Russians who happen to be in Brazil about a package written in Germany, which gladdened an American. Trotsky would be even more proud -- and amazed!! :-) Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile:

[R] Fwd: Percentiles/Quantiles with Weighting

2009-02-17 Thread Stavros Macrakis
Some minor improvements and corrections below # Simple weighted quantile # # v A vector of sortable observations # w A numeric vector of positive weights # p The quantile 0=p=1 # # Nothing fancy: no interpolation etc.; NA cases not thought through wquantile -

[R] How to: C# / R interface

2009-02-17 Thread Baggett, Jonathan W
This is my situation: I have a significant amount of data, and need to send it in pieces to R. I need R to return certain parameters for further use. I am sending files from C# (that are being queried from a database) into R. Currently I am trying to use the R(D)-Com package to figure out how

[R] Index-G1 error

2009-02-17 Thread mauede
I am using some functions from package clusterSim to evaluate the best clusters layout. Here is the features vector I am using to cluater 12 signals: alpha.vec [1] 0.8540039 0.8558350 0.8006592 0.8066406 0.8322754 0.8991699 0.8212891 [8] 0.8815918 0.9050293 0.9174194 0.8613281 0.8425293 In

[R] Added system Info:--Segmentation Fault occured while connecting to the database

2009-02-17 Thread Moumita Das
Hi All, Wanted to add some more information ,regarding my problem. configuration of teh OS and R:--- Linux 2.6.18-6-686 R.Version() $platform [1] i486-pc-linux-gnu $arch [1] i486 $os [1] linux-gnu $system [1] i486, linux-gnu $status [1] Patched $major [1] 2 $minor [1] 4.0 $year [1] 2006

[R] Added system Info:--Segmentation Fault occured while connecting to the database

2009-02-17 Thread Moumita Das
Oops !! I had also included just one library in my script i.e RMySQL.So sorry for the inconvenience:( -- Thanks Moumita [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Possible Cause of Segmentation Fault

2009-02-17 Thread Moumita Das
Hi All, If you have already finished reading my previous emails regarding segmentation fault , please have a look at this .I think this may help you to diagnose the reason for the segmentation fault and help me,because i don't understand much. Rather than running the script using the command

[R] basic inquiry regarding write.csv

2009-02-17 Thread CJ Rubio
i have a loop which looks likes this: data.info - rbind(data.info, cbind(station.id, year, date, max.discharge)) + y - split(data.info, data.info[station.id]) + for (i in names(y)) {write.csv(y[[i]], file=paste(i, .csv, sep=,))} i am wondering, where the file (which i am about to

Re: [R] Fwd: Percentiles/Quantiles with Weighting

2009-02-17 Thread Dieter Menne
Stavros Macrakis macrakis at alum.mit.edu writes: Some minor improvements and corrections below # Simple weighted quantile # # v A vector of sortable observations # w A numeric vector of positive weights # p The quantile 0=p=1 # # Nothing fancy: no interpolation etc.; NA cases not

Re: [R] basic inquiry regarding write.csv

2009-02-17 Thread ronggui
If the file is a relative path, then it should be in the working directory. Say, the working directory is E:/my_work_directory (of course, you can get it by getwd()), and you export a data frame a to csv by: write.csv(a, file=a.csv), then the file should be E:/my_work_directory/a.csv. Best

Re: [R] basic inquiry regarding write.csv

2009-02-17 Thread CJ Rubio
thanks for your reply.. is there something wrong with the code i have? because it doesn't write the file in the directory that i am using... for (i in names(y)) {write.csv(y[[i]], file=paste(i, .csv, sep=,))} thanks again.. ronggui-2 wrote: If the file is a relative path, then it

[R] using stepAIC with negative binomial regression - error message help

2009-02-17 Thread t c
Dear List, I am having problems running stepAIC with a negative binomial regression model.  I am working with data on manta ray abundance, using 20 predictor variables.  Predictors include variables for location (site), time (year, cos and sin of calendar day, length of day, percent lunar

Re: [R] basic inquiry regarding write.csv

2009-02-17 Thread ronggui
So far, I cannot see any mistake, though the sep= will be more elegant that sep=,. Are you sure your working directory is E:/my_work_directory? and is there any error msg? BTW, a reproducible example will help to get better response from the list. 2009/2/18 CJ Rubio cjru...@kongju.ac.kr:

Re: [R] basic inquiry regarding write.csv

2009-02-17 Thread CJ Rubio
this is the code that i have so far: data.path - file.path (D:/documents/research/5 stations) setwd(data.path) getwd() data - dir(.) num.files - length(data) for(i in 1:num.files) { + station.id - substring(data[i], 1,8) + DF - read.table(data[i], sep=,, blank.lines.skip = TRUE) + z

<    1   2