Re: [R] Data transformation

2010-01-25 Thread Lisa
Thank you so much. Lisa -- View this message in context: http://n4.nabble.com/Data-transformation-tp1289899p1289915.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Data transformation

2010-01-25 Thread Seeliger . Curt
r-help-boun...@r-project.org wrote on 01/25/2010 02:39:32 PM: x - read.table(textConnection(col1 col2 3 1 2 2 4 7 8 6 5 10), header=TRUE) I want to rewrite it as below: var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 1 0 1 0 0 0 0 0 0

Re: [R] Data transformation

2010-01-25 Thread Gabor Grothendieck
Try this: t(apply(x, 1, function(r) table(factor(r, levels = seq_len(max(x)) 1 2 3 4 5 6 7 8 9 10 [1,] 1 0 1 0 0 0 0 0 0 0 [2,] 0 2 0 0 0 0 0 0 0 0 [3,] 0 0 0 1 0 0 1 0 0 0 [4,] 0 0 0 0 0 1 0 1 0 0 [5,] 0 0 0 0 1 0 0 0 0 1 If you use aaply in the plyr package instead of apply then

Re: [R] Data import export zipped files from URLs

2010-01-24 Thread Peter Ehlers
That's not the case for me: Not Found The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. Firefox 3.6 -Peter Ehlers Velappan Periasamy wrote:

Re: [R] Data import export zipped files from URLs

2010-01-24 Thread Henrique Dallazuanna
The same error for me: Not Found The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. Please inform the site administrator of the referring page. On Sun, Jan 24, 2010 at 3:14 PM, Peter

Re: [R] Data import export zipped files from URLs

2010-01-23 Thread Velappan Periasamy
cannot open: HTTP status was '404 Not Found' while running the following commands f - tempfile() download.file(http://nseindia.com/content/equities/scripvol/datafiles/01-01-2010-TO-23-01-2010RCOMXN.csv;, f) myData - read.csv(f) On 1/19/10, Henrique Dallazuanna www...@gmail.com wrote: Try

Re: [R] Data import export zipped files from URLs

2010-01-23 Thread Velappan Periasamy
The same link works and dowloads data while copying and pasteing the link in firebox address box. the file is there and the server is active. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Data import export zipped files from URLs

2010-01-23 Thread Henrique Dallazuanna
Your url is wrong. is missing .zip in the end. See the code again. On Sat, Jan 23, 2010 at 6:37 AM, Velappan Periasamy veepsi...@gmail.com wrote:  cannot open: HTTP status was '404 Not Found' while running the following commands f - tempfile()

Re: [R] Data import export zipped files from URLs

2010-01-23 Thread Velappan Periasamy
http://nseindia.com/content/equities/scripvol/datafiles/01-01-2010-TO-23-01-2010RCOMXN.csv the url is correct. it is not zipped file. copy the url in the browser window you will get the this .. Symbol,Series,Date, Prev Close,Open Price,High Price,Low Price,Last Price,Close Price,Average

Re: [R] Data Manipulation

2010-01-22 Thread Don MacQueen
Does this example help? a - matrix(letters[1:12], ncol=3) a [,1] [,2] [,3] [1,] a e i [2,] b f j [3,] c g k [4,] d h l write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE) i j k l At 4:11 PM -0800 1/21/10, Peter Rote wrote: Thank you Dieter and

Re: [R] Data Manipulation

2010-01-22 Thread Peter Rote
Thank you Don for the code, but I get the following error massage: by(AlexETF,AlexETF$Industry,function(a) {filename = paste(C:/ab/,gsub( ,,a$Industry[1]),.txt,sep=) + print(filename) + write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE) + } + )

Re: [R] Data Manipulation

2010-01-21 Thread Peter Rote
Thank you Dieter and Rolf, I have solved the slash Problem, but I still struggling with the output files. I have tried this by(AlexETF,AlexETF$Industry,function(a) {filename = paste(C:/ab/,gsub( ,,a$Industry[1]),.txt,sep=) print(filename) write.table(a,file=filename,col.names

[R] Data Manipulation

2010-01-20 Thread Peter Rote
Dear All, I would like to to group the Ticker by Industry and create file names from the Industry Factor and export to a txt file. I have tried the folowing ind=finvizAllexETF$Industry ind is then Aluminum Business Services Regional Airlines ind2=gsub( ,,ind) ind3 [1] Aluminum

Re: [R] Data Manipulation

2010-01-20 Thread Dieter Menne
Peter Rote wrote: I would like to to group the Ticker by Industry and create file names from the Industry Factor and export to a txt file. I have tried the folowing ind=finvizAllexETF$Industry ind is then Aluminum Business Services Regional Airlines ind2=gsub(

Re: [R] Data Manipulation

2010-01-20 Thread Peter Rote
Thank you Dieter, but i still have a problem to write to file. The problem is the slash in file names (Aerospace/Defense Products Services ). If i want it to C:/ab/ so C:/ab/AdvertisingAgencies.txt is ok but C:/ab/Aerospace/Defense-MajorDiversified.txt is not head(AlexETF)

Re: [R] Data Manipulation

2010-01-20 Thread Peter Rote
by the way how do i change the output 1016 Advertising Agencies CMM 1803 Advertising Agencies FMCN 2427 Advertising Agencies IPG 3093 Advertising Agencies MWW 3372 Advertising Agencies OMC 4809 Advertising Agencies VCLK 4832 Advertising Agencies VISN 5005 Advertising Agencies WPPGY 5089

Re: [R] Data Manipulation

2010-01-20 Thread Rolf Turner
A name such as ``Aerospace/Defense etc.'' is certainly not a legal file name under unix-alike systems, and I suspect it would not be even under Windoze. Even if it is, you shouldn't use it! Change the name to ``Aerospace-Defense Products Services'' or something like that, for goodness sake.

Re: [R] Data Manipulation

2010-01-20 Thread Dieter Menne
Peter Rote wrote: but i still have a problem to write to file. The problem is the slash in file names (Aerospace/Defense Products Services ). If i want it to C:/ab/ so C:/ab/AdvertisingAgencies.txt is ok but C:/ab/Aerospace/Defense-MajorDiversified.txt is not As Rolf said, the

Re: [R] Data import export zipped files from URLs

2010-01-19 Thread Dieter Menne
Velappan Periasamy wrote: I am not able to import zipped files from the following link. How to get thw same in to R?. mydata - read.csv(http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip;) As Brian Ripley noted in

Re: [R] Data import export zipped files from URLs

2010-01-19 Thread Duncan Temple Lang
Dieter Menne wrote: Velappan Periasamy wrote: I am not able to import zipped files from the following link. How to get thw same in to R?. mydata - read.csv(http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip;) As Brian Ripley noted in

Re: [R] Data import export zipped files from URLs

2010-01-19 Thread Gabor Grothendieck
If you need an example of this look at the yacasInstall function in this file: http://ryacas.googlecode.com/svn/trunk/R/yacasInstall.R from the Ryacas package. It downloads, unzips and installs yacas and associated files for Windows users. On Tue, Jan 19, 2010 at 3:10 AM, Dieter Menne

Re: [R] Data import export zipped files from URLs

2010-01-19 Thread Velappan Periasamy
How to unzip this file?. mydata - unzip(http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip;) Warning message: In unzip(http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip;) : error 1 in extracting from zip file

Re: [R] Data import export zipped files from URLs

2010-01-19 Thread Henrique Dallazuanna
Try this: f - tempfile() download.file(http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip;, f) myData - read.csv(unzip(f)) On Tue, Jan 19, 2010 at 2:56 PM, Velappan Periasamy veepsi...@gmail.com wrote: How to unzip this file?. mydata -

[R] Data import export zipped files from URLs

2010-01-18 Thread Velappan Periasamy
I am not able to import zipped files from the following link. How to get thw same in to R?. mydata - read.csv(http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip;) __ R-help@r-project.org mailing list

[R] data frame names in sequence

2010-01-10 Thread Zoho
I've been stuck with this problem for a whole afternoon. It's silly but totally pissed me off. I have a set of data frames with names in a sequence: df_1, df_2, df_3, ..., df_20. Now I want to access each data frame (read or write) in a for loop, in a way something like this: for (i in 1:20) {

Re: [R] data frame names in sequence. please help!!!

2010-01-10 Thread Barry Rowlingson
On Sun, Jan 10, 2010 at 7:16 AM, Berend Hasselman b...@xs4all.nl wrote: Zoho wrote: I've been stuck with this problem for a whole afternoon. It's silly but totally pissed me off. I have a set of data frames with names in a sequence: df_1, df_2, df_3, ..., df_20. Now I want to access each

Re: [R] data frame names in sequence

2010-01-10 Thread jim holtman
?get for (i in 1:20) { df_i - get(paste('df_', i, sep='')) length(which(df_i[,7]==1)) ## } On Sat, Jan 9, 2010 at 7:57 PM, Zoho ynp...@gmail.com wrote: I've been stuck with this problem for a whole afternoon. It's silly but totally pissed me off. I have a set of data frames with

Re: [R] data frame names in sequence. please help!!!

2010-01-10 Thread Zoho
Thank you all. The 'list' works well, except makes a really big 'list', since my data is 'huge'. But solves the problem anyway. Appreciate a lot! Barry Rowlingson wrote: On Sun, Jan 10, 2010 at 7:16 AM, Berend Hasselman b...@xs4all.nl wrote: Zoho wrote: I've been stuck with this

Re: [R] data frame names in sequence. please help!!!

2010-01-09 Thread Berend Hasselman
Zoho wrote: I've been stuck with this problem for a whole afternoon. It's silly but totally pissed me off. I have a set of data frames with names in a sequence: df_1, df_2, df_3, ..., df_20. Now I want to access each data frame (read or write) in a for loop, in a way something like this:

Re: [R] Data Frame Transpose

2010-01-06 Thread Uwe Ligges
On 06.01.2010 03:14, Noli Sicad wrote: Hi John Thanks for your reply. I think I was posting properly the problem. Here are the error, R script and console errors below. Thanks. Noli ~~~ The error: ~~ Error in data.frame(CROP_ID = x[1, 1], CROPTYPE = x[1, 2], name =

[R] Data Frame Transpose

2010-01-05 Thread Noli Sicad
Hi, forests - read.csv(C:\\Down2\\R_forestmgt\\forest_cut-Age.csv) m - forests fn - function(x) { y - t(x[,2]) data.frame( Croptype=x[1,1], Period =x[1,2], name=colnames(x)[2], x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] } ---Problem here m - do.call( rbind,

[R] Data replacement

2010-01-05 Thread Lisa
Dear all, I have a question and need your help. I have a dataset that looks like this: data idcode1code2 1 114 2 123 3 244 4 315 5 324 6 4

Re: [R] Data Frame Transpose

2010-01-05 Thread John Kane
Well, if nothing else, you have missing comma. :) x01=y[,1]), x01=y[,1], x02=y[,2], x03=y[,3] -- fn - function(x) {   y - t(x[,2])   data.frame( Croptype=x[1,1], Period =x[1,2], name=colnames(x)[2], x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] } ---Problem here m -

Re: [R] Data replacement

2010-01-05 Thread Dieter Menne
Lisa wrote: I have a dataset that looks like this: data idcode1code2 1 114 2 123 3 244 .. I want to change some numbers in the columns of “code1” and “code2” based on “indx” as below

Re: [R] Data replacement

2010-01-05 Thread Lisa
Thank you for your kind help. Your R script works well. Lisa Dieter Menne wrote: Lisa wrote: I have a dataset that looks like this: data idcode1code2 1 114 2 123 3 244 .. I want

Re: [R] Data Frame Transpose

2010-01-05 Thread Noli Sicad
Hi John Thanks for your reply. I think I was posting properly the problem. Here are the error, R script and console errors below. Thanks. Noli ~~~ The error: ~~ Error in data.frame(CROP_ID = x[1, 1], CROPTYPE = x[1, 2], name = colnames(x)[4:5], : subscript out of bounds ~~~

[R] data download from metastock into r-software

2009-12-17 Thread SNV Krishna
Hi All, is there a way to download data from metastock to R-software. most of my data is in date,OHLC format downloaded from reuters to metastock software in my local pc. many thanks for the help., krishna [[alternative HTML version deleted]]

[R] Data

2009-12-11 Thread Jose Narillos de Santos
Hi all, Imagine I have a matrix and the first colum is a list that repeats the same names, I want to sum the second column on each unique name on first column. Imagine this: Pepe 2 Pepe 3 Pepe 4 Jose 2 Jose 5 Manuel 4 Manuel 2 I want to make a new matrix that calculates and recognizes that

Re: [R] Data

2009-12-11 Thread David Winsemius
On Dec 11, 2009, at 4:38 PM, Jose Narillos de Santos wrote: Hi all, Imagine I have a matrix and the first colum is a list that repeats the same names, I want to sum the second column on each unique name on first column. Imagine this: Pepe 2 Pepe 3 Pepe 4 Jose 2 Jose 5 Manuel 4 Manuel 2

Re: [R] Data

2009-12-11 Thread Jorge Ivan Velez
Hi Jose, Here is a suggestion using tapply(): R x - read.table(textConnection(Pepe 2 + Pepe 3 + Pepe 4 + Jose 2 + Jose 5 + Manuel 4 + Manuel 2), header = FALSE) R closeAllConnections() R x V1 V2 1 Pepe 2 2 Pepe 3 3 Pepe 4 4 Jose 2 5 Jose 5 6 Manuel 4 7 Manuel 2 R R R

Re: [R] data manipulation/subsetting and relation matrix

2009-12-08 Thread jim holtman
try this: myDat - read.table(textConnection(group id 1 101 1 201 1 301 2 401 2 501 2 601 3 701 3 801 3 901),header=TRUE) closeAllConnections() corr_mat -as.matrix(read.table(textConnection(1 1 .5 0 0 0 0 0 0 0 2 .5 1 0 0 0 0 0 0 0 3 00 1.0 0 0 0 0 0 0

[R] data manipulation/subsetting and relation matrix

2009-12-07 Thread Juliet Hannah
Hi List, Here is some example data. myDat - read.table(textConnection(group id 1 101 1 201 1 301 2 401 2 501 2 601 3 701 3 801 3 901),header=TRUE) closeAllConnections() corr_mat -read.table(textConnection(1 1 .5 0 0 0 0 0 0 0 2 .5 1 0 0 0 0 0 0 0 3 00 1.0 0

Re: [R] Data Manipulation Question

2009-12-04 Thread Barry Rowlingson
On Thu, Dec 3, 2009 at 9:52 PM, John Filben johnfil...@yahoo.com wrote: Can R support data manipulation programming that is available in the SAS datastep?  Specifically, can R support the following: -  Read multiple dataset one record at a time and compare values from each; then base

Re: [R] Data Manipulation Question

2009-12-04 Thread Gray Calhoun
This is probably far more discussion than the question warranted, but... On Thu, Dec 3, 2009 at 11:14 PM, David Winsemius dwinsem...@comcast.net wrote: On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote: The data import/export manual can elaborate on a lot of these; this is all straightforward,

[R] data manipulation

2009-12-03 Thread oscar linares
Dear Wiza[R]ds, I have a data.frame header that looks like this: v2FfaPre15v2FfaPre10v2FfaPre5v2Ffa2v2Ffa3v2Ffa4 I need it to look like this, 1510523 4 i.e., with v2FfaPre and v2Ffa stripped off Any suggestions, Thanks in advance! -- Oscar Oscar A.

Re: [R] data manipulation

2009-12-03 Thread jim holtman
try this: x - c('v2FfaPre15','v2FfaPre10','v2FfaPre5','v2Ffa2', 'v2Ffa3','v2Ffa4') sub(^.*?([0-9]+)$, \\1, x, perl=TRUE) [1] 15 10 5 2 3 4 On Thu, Dec 3, 2009 at 9:00 AM, oscar linares wins...@gmail.com wrote: Dear Wiza[R]ds, I have a data.frame header that looks

Re: [R] data manipulation

2009-12-03 Thread Henrique Dallazuanna
Try this: gsub(.*[^0-9], , header) On Thu, Dec 3, 2009 at 12:00 PM, oscar linares wins...@gmail.com wrote: Dear Wiza[R]ds, I have a data.frame header that looks like this: v2FfaPre15    v2FfaPre10    v2FfaPre5    v2Ffa2    v2Ffa3    v2Ffa4 I need it to look like this, 15    10    5    

Re: [R] data manipulation

2009-12-03 Thread Gabor Grothendieck
Try this where [0-9]+ matches one or more digits and $ matches the end of string. See http://gsubfn.googlecode.com for more. library(gsubfn) x - c(v2FfaPre15, v2FfaPre10, v2FfaPre5, v2Ffa2, v2Ffa3, v2Ffa4) strapply(x, [0-9]+$, c, simplify = TRUE) # or if you want a numeric result: strapply(x,

Re: [R] Data frame/read.ftable

2009-12-03 Thread Robinson, David G
David, Great! 'split' is something I didn't even look at. Owe you one. Many thanks, Dave On 12/2/09 7:29 PM, David Winsemius dwinsem...@comcast.net wrote: On Dec 2, 2009, at 7:02 PM, Robinson, David G wrote: My apologies for this question but I'm stuck and I'm sure that there must be an

[R] Data Manipulation Question

2009-12-03 Thread John Filben
Can R support data manipulation programming that is available in the SAS datastep?  Specifically, can R support the following: -          Read multiple dataset one record at a time and compare values from each; then base on if-then logic write to multiple output files -        

Re: [R] Data Manipulation Question

2009-12-03 Thread hadley wickham
On Thu, Dec 3, 2009 at 3:52 PM, John Filben johnfil...@yahoo.com wrote: Can R support data manipulation programming that is available in the SAS datastep?  Specifically, can R support the following: -  Read multiple dataset one record at a time and compare values from each; then base

Re: [R] Data Manipulation Question

2009-12-03 Thread Jason Morgan
Please refrain from posting HTML. The results can be incomprehensible: On 2009.12.03 13:52:09, John Filben wrote: Can R support data manipulation programming that is available in the SAS datastep??? Specifically, can R support the following: -?? Read multiple dataset one

Re: [R] Data Manipulation Question

2009-12-03 Thread Gray Calhoun
The data import/export manual can elaborate on a lot of these; this is all straightforward, although many people would prefer to use a relational database for some of the things you mentioned. I'm not aware of a goto command in R, though (although I could be wrong). --Gray On Thu, Dec 3, 2009 at

Re: [R] Data Manipulation Question

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote: The data import/export manual can elaborate on a lot of these; this is all straightforward, although many people would prefer to use a relational database for some of the things you mentioned. See Wickham's pithy response to this. I'm not

[R] Data frame/read.ftable

2009-12-02 Thread Robinson, David G
My apologies for this question but I¹m stuck and I¹m sure that there must be an easy answer out there (and hope that someone will have mercy and point me in the right direction). I have a data file that looks like: 1 77 3 1 8 1 1 7 2 1 1 5 1 42 7 1 0 2 1 23 1 2 83 9 2 8 2 2 6 5 2 23 3 3 11 3 3 8

Re: [R] Data frame/read.ftable

2009-12-02 Thread David Winsemius
On Dec 2, 2009, at 7:02 PM, Robinson, David G wrote: My apologies for this question but I¹m stuck and I¹m sure that there must be an easy answer out there (and hope that someone will have mercy and point me in the right direction). I have a data file that looks like: 1 77 3 1 8 1 1 7 2 1

[R] Data linkage functions for probabilistic linkage using person identifiers

2009-11-18 Thread Dagan A WRIGHT
I am somewhat new to R although using and liking already. I am curious if there are any probabilistic packages similar in function to others such and Link King (http://www.the-link-king.com/). I am looking for functions in SSN, First/Last name, date of birth, and a couple other indicators for

Re: [R] Data linkage functions for probabilistic linkage using person identifiers

2009-11-18 Thread David Winsemius
On Nov 18, 2009, at 1:21 PM, Dagan A WRIGHT wrote: I am somewhat new to R although using and liking already. I am curious if there are any probabilistic packages similar in function to others such and Link King (http://www.the-link-king.com/). I am looking for functions in SSN,

Re: [R] Data linkage functions for probabilistic linkage using person identifiers

2009-11-18 Thread Doran, Harold
to further explore probabilities of a correct match. Harold -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Wednesday, November 18, 2009 4:32 PM To: Dagan A WRIGHT Cc: r-help@r-project.org Subject: Re: [R] Data

[R] Data source name not found and no default driver specified

2009-11-16 Thread helpme
I'm stumped. When trying to connect to Oracle using the RODBC package I get an error: *[RODBC] Data source name not found and no default driver specified. ODBC connect failed.* I've read over all the posts and documentation manuals. The system is Windows Server 2003 with R 2.81. and the latest

Re: [R] Data source name not found and no default driver specified

2009-11-16 Thread helpme
I forgot to mention that it's running Windows Server 2003 x64 OS version On Mon, Nov 16, 2009 at 11:22 AM, helpme myrquesti...@gmail.com wrote: I'm stumped. When trying to connect to Oracle using the RODBC package I get an error: *[RODBC] Data source name not found and no default driver

Re: [R] data frame subsets?

2009-11-13 Thread David Winsemius
On Nov 12, 2009, at 10:57 PM, Douglas M. Hultstrand wrote: Hello, I am trying to create data frame subsets based on binned temperature data. I have code working to create the bins (d.1 and d.2), but it takes two steps, I was wondering if I could merge into one step. See Below d n

[R] data frame subsets?

2009-11-12 Thread Douglas M. Hultstrand
Hello, I am trying to create data frame subsets based on binned temperature data. I have code working to create the bins (d.1 and d.2), but it takes two steps, I was wondering if I could merge into one step. See Below d n year mo da hr t td tw rh kPa 1 1 1945 3 1 0 1.1 0.0

Re: [R] data frame subsets?

2009-11-12 Thread Jorge Ivan Velez
Hi Douglas, Here is a suggestion: subset(d, t = 1 t 2) See ?subset for more information. HTH, Jorge On Thu, Nov 12, 2009 at 10:57 PM, Douglas M. Hultstrand wrote: Hello, I am trying to create data frame subsets based on binned temperature data. I have code working to create the bins

Re: [R] Data transformation

2009-11-11 Thread jim holtman
Try this: x - read.table(textConnection(idcode1code2 p + 148 0.1 + 157 0.9 + 218 0.4 + 262 0.2 + 243 0.6 + 356 0.7 +

Re: [R] Data transformation

2009-11-11 Thread legen
Your script works very well. Thank you very much. Legen Henrique Dallazuanna wrote: Try this also: xtabs(rep(p, 2) ~ rep(id, 2) + sprintf(var%d, c(code1, code2)), data = x) On Wed, Nov 11, 2009 at 2:10 AM, legen lege...@gmail.com wrote: Thank you for your kind help. Your script

Re: [R] Data transformation

2009-11-11 Thread legen
That's what I want. Many thanks for your help. Legen jholtman wrote: Try this: x - read.table(textConnection(idcode1code2 p + 148 0.1 + 157 0.9 + 218 0.4 + 262

[R] Data transformation

2009-11-10 Thread legen
Dear all, I have a dataset as below: idcode1code2 p 148 0.1 157 0.9 218 0.4 262 0.2 243 0.6 356 0.7 37

Re: [R] Data transformation

2009-11-10 Thread jim holtman
Is this what you want: x - read.table(textConnection(idcode1code2 p + 148 0.1 + 157 0.9 + 218 0.4 + 262 0.2 + 243 0.6 + 356

Re: [R] Data transformation

2009-11-10 Thread legen
Thank you for your kind help. Your script works very well. Would you please show me how to change NaN to zero and column variables 1, 2, ..., 8 to var1, var2, ..., var8? Thanks again. Legen jholtman wrote: Is this what you want: x - read.table(textConnection(idcode1code2

[R] Data Partition Package

2009-10-28 Thread Xu
Hi, Users, I am a new user. I am trying to partition data into training and test. Is there any R package or function that can partition dataset? Also, is there any package do crossvalidation? Any help will be appreciated. Best, Pat [[alternative HTML version deleted]]

Re: [R] Data Partition Package

2009-10-28 Thread Max Kuhn
There are a few. I'm partial to the function in the caret package: createDataPartition. Also, there are functions there for pre-processing on training sets and applying it to new data sets. For a somewhat dated summary of the packages, see: http://www.jstatsoft.org/v28/i05 also:

Re: [R] Data Partition Package

2009-10-28 Thread Xu
Thanks a lot. Have a nice day! Best, Pat On Wed, Oct 28, 2009 at 10:29 AM, Max Kuhn mxk...@gmail.com wrote: There are a few. I'm partial to the function in the caret package: createDataPartition. Also, there are functions there for pre-processing on training sets and applying it to new data

Re: [R] data frame is killing me! help

2009-10-26 Thread Petr PIKAL
Hi data(gasoline) str(gasoline) 'data.frame': 60 obs. of 2 variables: $ octane: num 85.3 85.2 88.5 83.4 87.9 ... $ NIR : AsIs [1:60, 1:401] -0.050193 -0.044227 -0.046867 -0.046705 -0.050859 ... ..- attr(*, dimnames)=List of 2 .. ..$ : chr 1 2 3 4 ... .. ..$ : chr 900 nm 902 nm

Re: [R] data frame is killing me! help

2009-10-26 Thread bbslover
Thank you ,Petr It is a good answer,clearly. thanks! Petr Pikal wrote: Hi data(gasoline) str(gasoline) 'data.frame': 60 obs. of 2 variables: $ octane: num 85.3 85.2 88.5 83.4 87.9 ... $ NIR : AsIs [1:60, 1:401] -0.050193 -0.044227 -0.046867 -0.046705 -0.050859 ... ..-

Re: [R] data frame is killing me! help

2009-10-24 Thread bbslover
I have try it, past can add to wanted letter, but can not past the colume names. May be I should learn it hard. Don MacQueen wrote: At 4:57 AM -0700 10/23/09, bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A

Re: [R] data frame is killing me! help

2009-10-24 Thread bbslover
thank you Don MacQueen , I will try it. Don MacQueen wrote: At 4:57 AM -0700 10/23/09, bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane

Re: [R] Data format for KSVM

2009-10-24 Thread Uwe Ligges
Noah Silverman wrote: Hi, I have a process using svm from the e1071 library. It's called a *package* which is probably installed in a *library* of packages. it works. I want to try using the KSVM library instead. The same data used wiht e1071 gives me an error with KSVM. I guess

[R] data file with columns of unequal length

2009-10-23 Thread William Simpson
I am running an expt that presents a point process input x and measures a point process output y. The times of each event are recorded. The lengths of the data records of x and y are necessarily different, and can be different by a factor of 10. I would like to save these data after each

Re: [R] data file with columns of unequal length

2009-10-23 Thread Jim Lemon
On 10/23/2009 07:58 PM, William Simpson wrote: I am running an expt that presents a point process input x and measures a point process output y. The times of each event are recorded. The lengths of the data records of x and y are necessarily different, and can be different by a factor of 10. I

Re: [R] data file with columns of unequal length

2009-10-23 Thread Peter Dalgaard
Jim Lemon wrote: On 10/23/2009 07:58 PM, William Simpson wrote: I am running an expt that presents a point process input x and measures a point process output y. The times of each event are recorded. The lengths of the data records of x and y are necessarily different, and can be different by

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
The way you do it is to compute the cross-intensity function (you can google this; a key name is David Brillinger). The general problem is that of system identification for point processes. Bill On Fri, Oct 23, 2009 at 10:31 AM, Jim Lemon j...@bitwrit.com.au wrote: On 10/23/2009 07:58 PM,

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
As I understand it, they don't come in pairs anyway. Correct. For the same reason a data frame is just the wrong kind of data structure. If you don't want separate data files, you can use one file with two columns where the second column is (say) 1 for the x and 2 for the y. Could you

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
Thanks Jim. BTW the times in x and y are in ascending order (time of occurrence). If I do it this way, how do I actually read the data in and store in the file? Toy code, please. Bill Hi Bill, xy-list(x=1:10,y=1:100) Note that this cheerfully ignores how you are going to figure out which

Re: [R] data file with columns of unequal length

2009-10-23 Thread Peter Dalgaard
William Simpson wrote: As I understand it, they don't come in pairs anyway. Correct. For the same reason a data frame is just the wrong kind of data structure. If you don't want separate data files, you can use one file with two columns where the second column is (say) 1 for the x and 2

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
OK thanks, I look at sleep and get it Bill On Fri, Oct 23, 2009 at 12:21 PM, Peter Dalgaard p.dalga...@biostat.ku.dk wrote: William Simpson wrote: As I understand it, they don't come in pairs anyway. Correct. For the same reason a data frame is just the wrong kind of data structure. If you

Re: [R] data file with columns of unequal length

2009-10-23 Thread Jim Lemon
On 10/23/2009 10:07 PM, William Simpson wrote: Thanks Jim. BTW the times in x and y are in ascending order (time of occurrence). If I do it this way, how do I actually read the data in and store in the file? Toy code, please. Hi Bill, This seems a bit like some heartbeat data that I had

Re: [R] data file with columns of unequal length

2009-10-23 Thread Jim Lemon
On 10/23/2009 10:07 PM, William Simpson wrote: Thanks Jim. BTW the times in x and y are in ascending order (time of occurrence). If I do it this way, how do I actually read the data in and store in the file? Toy code, please. Hi Bill, This seems a bit like some heartbeat data that I had to

Re: [R] data frame is killing me! help

2009-10-23 Thread bbslover
Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401 columns. The NIR spectrum and I see the

Re: [R] data frame is killing me! help

2009-10-23 Thread James W. MacDonald
bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401 columns. The NIR spectrum and I see the

[R] Data format for KSVM

2009-10-23 Thread Noah Silverman
Hi, I have a process using svm from the e1071 library. it works. I want to try using the KSVM library instead. The same data used wiht e1071 gives me an error with KSVM. My data is a data.frame. sample code: svm_formula - formula(y ~ a + B + C) svm_model - ksvm(formula, data=train_data,

Re: [R] data frame is killing me! help

2009-10-23 Thread Don MacQueen
At 4:57 AM -0700 10/23/09, bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401

Re: [R] data frame is killing me! help

2009-10-23 Thread bbslover
I have read that one ,I want to this method to be used to my data.but I donot know how to put my data into R. James W. MacDonald wrote: bbslover wrote: Steve Lianoglou-6 wrote: Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60

[R] data frame is killing me! help

2009-10-22 Thread bbslover
Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401 columns. The NIR spectrum and I see the gasoline data to see below NIR.1686 nm NIR.1688 nm NIR.1690 nm NIR.1692 nm NIR.1694 nm

Re: [R] data frame is killing me! help

2009-10-22 Thread Steve Lianoglou
Hi, On Oct 22, 2009, at 2:35 PM, bbslover wrote: Usage data(gasoline) Format A data frame with 60 observations on the following 2 variables. octane a numeric vector. The octane number. NIR a matrix with 401 columns. The NIR spectrum and I see the gasoline data to see below NIR.1686 nm

[R] Data frame search and remove questions

2009-10-15 Thread Douglas M. Hultstrand
Hello, I have a couple questions about removing rows from a data frame and creating a new data frame with the removed values. I provided an example data frame (d) below. Questions: 1) How can I search for -999.000 and remove the entire row from data frame d? (all -999 values will be in

Re: [R] Data frame search and remove questions

2009-10-15 Thread David Winsemius
On Oct 15, 2009, at 1:17 PM, Douglas M. Hultstrand wrote: Hello, I have a couple questions about removing rows from a data frame and creating a new data frame with the removed values. I provided an example data frame (d) below. Questions: 1) How can I search for -999.000 and remove the

[R] Data Step: Outer Join Rows, Inner Join Columns

2009-09-29 Thread schimpanski
Hi, how can I do a data step in R which can be best described in SQL terminology as an outer join of rows (eg cases) and inner join of columns (variables)? In case of conflicting non-missing values the first dataset has higher always priority. Missing values should always be replaced by valid

Re: [R] Data Step: Outer Join Rows, Inner Join Columns

2009-09-29 Thread Christian Schulz
Hi, if you like to use sql you can use the sqldf package. Another possibility is the basic function merge. HTH Christian Hi, how can I do a data step in R which can be best described in SQL terminology as an outer join of rows (eg cases) and inner join of columns (variables)? In

[R] Data source for American college football rankings?

2009-09-29 Thread Douglas Bates
An interesting, and topical, example of multivariate data for classroom illustrations are the American college football rankings. Starting at the end of October (or week 8, the 8th week of the football season) a set of rankings called the BCS (Bowl Championship Series) will be published. This is

<    6   7   8   9   10   11   12   13   14   15   >