Re: [R] Extracting data using subset function

2023-02-06 Thread Upananda Pani
gt; Realistically, the above technique generalizes to more complex cases > decently. But sometimes, head(0 and other things I mentioned earlier work > quite well. > > > -Original Message----- > From: R-help On Behalf Of Upananda Pani > Sent: Sunday, February 5, 2023 2:3

Re: [R] Extracting data using subset function

2023-02-05 Thread avi.e.gross
ani Sent: Sunday, February 5, 2023 2:33 PM To: Andrés González Carmona Cc: r-help Subject: Re: [R] Extracting data using subset function Thank you. It means we can not use the subset function here. Regards On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote: > From ?subset: > Warn

Re: [R] Extracting data using subset function

2023-02-05 Thread Rolf Turner
On Sun, 5 Feb 2023 15:13:54 -0500 Duncan Murdoch wrote: > > Just to build the mountain a little higher, I would use > >subset(p, seq_along(p) <= 20) > > You should generally avoid expressions like "1:length(p)", because > they don't do what you would expect in the unusual case that p is

Re: [R] Extracting data using subset function

2023-02-05 Thread Rui Barradas
Às 22:14 de 05/02/2023, Rui Barradas escreveu: Às 19:33 de 05/02/2023, Upananda Pani escreveu: Thank you. It means we can not use the subset function here. Regards On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote:  From ?subset: Warning This is a convenience function intended fo

Re: [R] Extracting data using subset function

2023-02-05 Thread Rui Barradas
Às 19:33 de 05/02/2023, Upananda Pani escreveu: Thank you. It means we can not use the subset function here. Regards On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote: From ?subset: Warning This is a convenience function intended for use interactively. For programming it is better

Re: [R] Extracting data using subset function

2023-02-05 Thread Uwe Ligges
a single vector. -Original Message- From: R-help On Behalf Of Upananda Pani Sent: Sunday, February 5, 2023 2:33 PM To: Andrés González Carmona Cc: r-help Subject: Re: [R] Extracting data using subset function Thank you. It means we can not use the subset function here. Regards On Mon, 6 Feb, 20

Re: [R] Extracting data using subset function

2023-02-05 Thread Jim Lemon
Hi Upananda, As a couple of respondents noted, you only need the logical statement, not subset(). You did "frame the logical condition" in your example, for if you use the extraction operator "[" this will work: subset(p,(1:length(p)) <= 20) as Jeff already pointed out. Obviously it is easier to w

Re: [R] Extracting data using subset function

2023-02-05 Thread avi.e.gross
, albeit you can make a data.frame containing a single vector. -Original Message- From: R-help On Behalf Of Upananda Pani Sent: Sunday, February 5, 2023 2:33 PM To: Andrés González Carmona Cc: r-help Subject: Re: [R] Extracting data using subset function Thank you. It means we can no

Re: [R] Extracting data using subset function

2023-02-05 Thread Jeff Newmiller
I will not (re-)define the basic terms used in describing how R is used... do read [1] for that. [1] https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Writing-your-own-functions, also via RShowDoc("R-intro"), in particular contrast section 1.5 vs section 10. On February 5, 2023 12:

Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Hi Rolf, Thank you so much. I was just curious to know that. I am glad that i got the input from all of you. I am grateful to you for clarifying. With sincere gratitude, Upananda On Mon, Feb 6, 2023 at 1:29 AM Rolf Turner wrote: > On Sun, 5 Feb 2023 19:37:03 +0530 > Upananda Pani wrote: > >

Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Hi Jeff, Thanks for your reply. What do you exactly mean by "interactively"? Would you please give me an example? Upananda On Mon, Feb 6, 2023 at 1:27 AM Jeff Newmiller wrote: > No, it means what it says: it is best used interactively rather than in > functions. That is not saying you cannot u

Re: [R] Extracting data using subset function

2023-02-05 Thread Duncan Murdoch
On 05/02/2023 2:59 p.m., Rolf Turner wrote: On Sun, 5 Feb 2023 19:37:03 +0530 Upananda Pani wrote: Dear All, I want to create a vector p and extract first 20 observations using subset function based on logical condition. My code is below p <- 0:100 I know i can extract the first 20 observa

Re: [R] Extracting data using subset function

2023-02-05 Thread Rolf Turner
On Sun, 5 Feb 2023 19:37:03 +0530 Upananda Pani wrote: > Dear All, > > I want to create a vector p and extract first 20 observations using > subset function based on logical condition. > > My code is below > > p <- 0:100 > > I know i can extract the first 20 observations using the following >

Re: [R] Extracting data using subset function

2023-02-05 Thread Jeff Newmiller
No, it means what it says: it is best used interactively rather than in functions. That is not saying you cannot use it... merely that you should probably use it interactively. The fact is, though, that integer indexing is much simpler and clearer for your particular example than subset is. q

Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Thank you. It means we can not use the subset function here. Regards On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, wrote: > From ?subset: > Warning > > This is a convenience function intended for use interactively. For > programming it is better to use the standard subsetting functions li

Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
How you have defined z1? On Mon, 6 Feb, 2023, 00:14 粕谷英一, wrote: > Do you mean something like the following? Here the first elements are > selected by subset function. > > > x1 > [1] 9 8 7 6 5 4 3 > > z1 > [1] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE > > subset(x1,z1) > [1] 9 8 7 >

Re: [R] Extracting data using subset function

2023-02-05 Thread 粕谷英一
Do you mean something like the following? Here the first elements are selected by subset function. > x1 [1] 9 8 7 6 5 4 3 > z1 [1] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE > subset(x1,z1) [1] 9 8 7 2023年2月6日(月) 3:34 Upananda Pani : > > No i am teaching Econometrics and learning R. I

Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
No i am teaching Econometrics and learning R. I am not a student. Thank you Upananda On Sun, 5 Feb, 2023, 19:51 Chris Ryan via R-help, wrote: > Is this a homework problem? > > --Chris Ryan > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. > > On February 5, 2023 9:07:0

Re: [R] Extracting data using subset function

2023-02-05 Thread Chris Ryan via R-help
Is this a homework problem? --Chris Ryan -- Sent from my Android device with K-9 Mail. Please excuse my brevity. On February 5, 2023 9:07:03 AM EST, Upananda Pani wrote: >Dear All, > >I want to create a vector p and extract first 20 observations using subset >function based on logical conditio

Re: [R] extracting data files names with odd numbers from folder

2022-04-03 Thread Jeff Newmiller
You need to learn regular expression patterns... there are lots of languages that use them, and tutorial websites that teach them to you. They are not the same as filename globbing patterns, and list.files uses regex because they are much more flexible. Here is an example: list.files( pattern

Re: [R] Extracting data and saving in excel

2020-10-23 Thread Rui Barradas
Hello, First coerce the column birth to class Date, then subset. data$birth <- as.Date(data$birth) i <- data$birth > as.Date("1979-01-01") subdata <- data[i, ] To write back to Excel, use write.csv or a package able to write Excel files directly. Hope this helps, Rui Barradas Às 12:23 d

Re: [R] Extracting data from list of lists of dataframes

2020-05-27 Thread Bert Gunter
?reproducible example (see posting guide below) or https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example However, I would suggest that you spend some time with an R tutorial or two rather than flailing about with such queries here. R has basic tools -- indexing by

Re: [R] Extracting data from zip file in one directory to a different directory.

2019-02-25 Thread Jeff Newmiller
My bet is that the zip file is corrupt. Also, carefully read the documentation for the unzip function... your attempt 1 was not going to work as posed even with a valid file. On February 25, 2019 2:22:10 AM PST, "Montgomery, Nigel" wrote: >Hi there, I've tried several different ways to do the

Re: [R] Extracting data from a file containing data

2015-07-02 Thread Peter Tuju
2, 2015 3:49 AM Subject: Re: [R] Extracting data from a file containing data Here is a way to do case I.  It uses the 'tidyr' package and produces results like: > case1[[1]]     YR JF-R_NINO1.2 MAM-R_NINO1.2 JJA-R_NINO1.2 OND-R_NINO1.21   > 1982           ML            ML  

Re: [R] Extracting data from a file containing data

2015-07-01 Thread jim holtman
Here is a way to do case I. It uses the 'tidyr' package and produces results like: > case1[[1]] YR JF-R_NINO1.2 MAM-R_NINO1.2 JJA-R_NINO1.2 OND-R_NINO1.2 1 1982 MLMLMESE 2 1983 SESESEME 3 1984

Re: [R] Extracting data from a file containing data

2015-06-26 Thread Peter Tuju
| | | | | | | 2.To use the Yearly anomalies for each column in nino regions toclassify the events as;(i). IfANOM Mean>1, then I assign itto “SE” (Being as Strong El-nino)(ii). If0 To: Peter Tuju Cc: "r-help@r-project.org" Sent: Thursday, June 25

Re: [R] Extracting data from a file containing data

2015-06-25 Thread jim holtman
try this: > input <- read.table("C:\\Users\\jh52822\\Downloads\\Nino_indices.txt" + , header = TRUE + , as.is = TRUE + ) > # create factors > input$season <- factor(c(rep("JF", 2), rep("MAM", 3), rep("JJA", 3) + , NA, rep("OND", 3

Re: [R] Extracting data from a file containing data

2015-06-25 Thread jim holtman
What happened to September? Just disregard? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jun 25, 2015 at 11:40 AM, Peter Tuju wrote: > I have the data as attached. For each nino region, I want t

Re: [R] Extracting data from a file containing data

2015-06-25 Thread David L Carlson
4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Tuju Sent: Thursday, June 25, 2015 10:40 AM To: r-help@r-project.org Subject: Re: [R] Extracting data from a file containing data I have the data as attached. For each nino region, I want to get the mea

Re: [R] Extracting data from a file containing data

2015-06-25 Thread Peter Tuju
I have the data as attached. For each nino region, I want to get the mean of the seasons January and February (JF), March, April and may (MAM), June, July and August (JJA), and October, November and December (OND) as columns of each nino regions. and have my result as;For example; For NINO1.2Yea

Re: [R] Extracting data from density plots

2014-06-13 Thread Adams, Jean
I don't know if you can get the information from the plot, but you can certainly get it from the density() function directly. For example, # fake data TestVar <- rnorm(60) type <- rep(c("Bottom", "Other", "Top"), 20) # density of TestVar for each type, estimated at 100 points along range of Test

Re: [R] extracting data coincident with the beginning and end of multiple streaks (rle)

2013-06-21 Thread arun
Hi, May be this helps: ###Added more lines of fake data fn_hp<- read.table(text=" id   date  wl_m    wet    cuml_day 585 fn 2012-03-03   0.1527048   1    1  586 fn 2012-03-04   0.2121408   1    2  587 fn 2012-03-05   0.1877568   1    3   

Re: [R] Extracting data from dataframe with tied rows

2012-08-24 Thread William Dunlap
are wdunlap tibco.com > -Original Message- > From: Peter Ehlers [mailto:ehl...@ucalgary.ca] > Sent: Friday, August 24, 2012 10:51 AM > To: William Dunlap > Cc: Peter Alspach; rjb; r-help@r-project.org > Subject: Re: [R] Extracting data from dataframe with tied rows > >

Re: [R] Extracting data from dataframe with tied rows

2012-08-24 Thread Peter Ehlers
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Alspach Sent: Thursday, August 23, 2012 4:37 PM To: rjb; r-help@r-project.org Subject: Re: [R] Extracting data from dataframe with tied rows Tena koe John One way: johnData <

Re: [R] Extracting data from dataframe with tied rows

2012-08-24 Thread William Dunlap
t.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Peter Alspach > Sent: Thursday, August 23, 2012 4:37 PM > To: rjb; r-help@r-project.org > Subject: Re: [R] Extracting data from dataframe with tied rows > > Tena koe John > > One way: > > johnData <-

Re: [R] Extracting data from dataframe with tied rows

2012-08-23 Thread Peter Alspach
Tena koe John One way: johnData <- data.frame(id=rep(LETTERS[1:5],20), distance=rnorm(1:100, mean = 100), bearing=sample(1:360,100,replace=T), month=sample(1:12,100,replace=T)) johnAgg <- aggregate(johnData[,'distance'], johnData[,c('id','month')], max) names(johnAgg)[3] <- 'distance' merge(john

Re: [R] extracting data from unstructured (text?) file

2012-03-12 Thread jim holtman
On Sun, Mar 11, 2012 at 9:21 PM, frauke wrote: > Wow Jim, this is much more than I expected. Thank you!! > > It took me a while to figure out what exactly you are doing in that code. > But I think I understand and it definitely runs. May I ask you two follow up > questions? > > First, some of my f

Re: [R] extracting data from unstructured (text?) file

2012-03-11 Thread frauke
Wow Jim, this is much more than I expected. Thank you!! It took me a while to figure out what exactly you are doing in that code. But I think I understand and it definitely runs. May I ask you two follow up questions? First, some of my files have data from two or more cities in them. So I have tr

Re: [R] extracting data from unstructured (text?) file

2012-03-11 Thread jim holtman
Here is one way assuming the data start after QPF FORECAST: > setwd('/temp') # where the data is > files <- c('sample1.htm', 'sample2.htm') # files to read > # assumes 4 columns of data > fields <- list(c(19, 24), c(30, 35), c(41, 46), c(52, 57)) #columns of data > results <- lapply(files, func

Re: [R] extracting data from unstructured (text?) file

2012-03-11 Thread frauke
Thank you for the quick reply! I have attached two files. http://r.789695.n4.nabble.com/file/n4464511/sample1.1339z sample1.1339z http://r.789695.n4.nabble.com/file/n4464511/sample2.1949z sample2.1949z -- View this message in context: http://r.789695.n4.nabble.com/extracting-data-from-unstruct

Re: [R] extracting data from unstructured (text?) file

2012-03-11 Thread Vijaya Parthiban
Hi Frauke, Try unix commands with R's system() function. Example: Let's say you have a matrix like this in the file (note: the first element is missing) called hello.txt 10 100 2 20 200 3 30 300 4 40 400 5 50 500 You can try something like: hello = system("cut -f1 hello.txt", intern=T) VP. On

Re: [R] extracting data from unstructured (text?) file

2012-03-11 Thread jim holtman
Can you at least provide a subset of 2 files so we can see how the data is really stored in the file and what the separators are between the 'columns' of data. Also how do you determine where the data actually starts for the rows that you want to pull off. This will aid in determining how to pars

Re: [R] Extracting data from a zoo by date

2012-03-06 Thread Gabor Grothendieck
On Tue, Mar 6, 2012 at 3:06 PM, Mago84 wrote: > Dear all, > > I know that it is a silly question, but I have a zoo object like this: > >                    valor1  valor2 > 01/02/08 36.7381 17.0097 > 01/03/08 36.9296 16.8331 > 01/04/08 35.6934 16.3539 > 01/07/08 35.3539 16.3791 > 01/08/08 36.3811

Re: [R] Extracting data from trellis object

2012-01-26 Thread Jean V Adams
tsippel wrote on 01/25/2012 01:23:05 PM: > Simple question (I hope?). How does one extract the data from a trellis > object? I need to get the data from a call to histogram(). > > A simple example below... > > dat<-data.frame(year=as.factor(round(runif(500, 1990, 2010))), x=rnorm(500, > 75, 35

Re: [R] Extracting data from SQL Server based on R parameters

2012-01-23 Thread Jeff Newmiller
Without write access to the SQL database, you cannot merge data from both sources within the SQL query. You can use paste to build a list of literal strings that you can refer to in the SQL where clause with IN, pull the results into R, then use the merge function to combine the data frames in R

Re: [R] Extracting Data from SQL Server

2012-01-10 Thread dthomas
a.diag03 = b.[ICD-10 Codes] I am not sure why your table name CVD_ICD10 has a suffix $. From: Jeff Newmiller <[hidden email]> To: dthomas <[hidden email]>; [hidden email] Sent: Tuesday, 10 January 2012, 8:00 Subject: Re: [R] Extracting Data from SQL Ser

Re: [R] Extracting Data from SQL Server

2012-01-10 Thread Ajay Askoolum
Newmiller To: dthomas ; r-help@r-project.org Sent: Tuesday, 10 January 2012, 8:00 Subject: Re: [R] Extracting Data from SQL Server This is OT here. However, you might want to investigate the UNIQUE keyword in the SQL Server documentation for SELECT

Re: [R] Extracting Data from SQL Server

2012-01-10 Thread Jeff Newmiller
This is OT here. However, you might want to investigate the UNIQUE keyword in the SQL Server documentation for SELECT. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] Extracting data by row

2011-10-29 Thread William Dunlap
You didn't show the details of what you did before Ten<-dataTable1[(dataTable1$sensor_depth_m=="10"),] but that line makes me suspicious that you did some experimentation with syntax before coming up with that line. In particular, why did you use parentheses around (dataTable1$sensor_depth_m

Re: [R] Extracting data by row

2011-10-29 Thread Rainer Schuermann
On Friday 28 October 2011 18:04:59 Vinny Moriarty wrote: > Thanks everyone for you help with my last question, and now I have one > last one... Here is what I would do, based on my understanding of your question: # your data snippet as data frame > x site time_localtime_utc

Re: [R] extracting data

2011-07-04 Thread Ana Kolar
Thanks! That works well. Best, Ana > >From: Peter Ehlers >To: Ana Kolar >Cc: Sarah Goslee ; R >Sent: Tuesday, 28 June 2011, 19:37 >Subject: Re: [R] extracting data > >On 2011-06-28 09:54, Ana Kolar wrote: >> Hi Sarah, >>

Re: [R] extracting data

2011-06-28 Thread Peter Ehlers
: Sarah Goslee To: Ana Kolar Cc: R Sent: Tuesday, 28 June 2011, 18:44 Subject: Re: [R] extracting data Hi Ana, On Tue, Jun 28, 2011 at 12:28 PM, Ana Kolar wrote: Let's say I have an original data set which is called A and data extracted from this original data set, called B. Based on t

Re: [R] extracting data

2011-06-28 Thread Ana Kolar
la=f, data=A, method=m) B <- match.data(m.out.base) An <- nrow(A) Bn <- nrow(B) Cn <- An - Bn C <- ?? > >From: Sarah Goslee >To: Ana Kolar >Cc: R >Sent: Tuesday, 28 June 2011, 18:44 >Subject: Re: [R] extracting data > >

Re: [R] extracting data

2011-06-28 Thread Sarah Goslee
Hi Ana, On Tue, Jun 28, 2011 at 12:28 PM, Ana Kolar wrote: > Let's say I have an original data set which is called A and data extracted > from this original data set, called B. Based on these A and B data set I > would like to get data set C which includes all the remaining data from the > dat

Re: [R] Extracting data only for particular index values from a zoo structure

2010-11-05 Thread Gabor Grothendieck
On Fri, Nov 5, 2010 at 11:54 AM, Santosh Srinivas wrote: > Thanks Gabor for pointing in the right direction. > Looked up cycle and the doc is tough to understand " cycle gives the > positions in the cycle of each observation." ... how is cycle defined. > > I just extended your idea to make it read

Re: [R] Extracting data only for particular index values from a zoo structure

2010-11-05 Thread Santosh Srinivas
index(mRet),"%m")==11] -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 05 November 2010 20:59 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Extracting data only for particular index values from a zoo structure On Fri, Nov

Re: [R] Extracting data only for particular index values from a zoo structure

2010-11-05 Thread Gabor Grothendieck
On Fri, Nov 5, 2010 at 11:21 AM, Santosh Srinivas wrote: > Hello All, > > I have a zoo structure as follows: >> dput(tMRet) > structure(c(0.00138742474397713, -0.0309023681475112, 0.0390276302410908, > 0.0832282874685357, -0.00315002033871414, -0.0158548785709138, > -0.0410876001496389, -0.0503189

Re: [R] Extracting data subset for plot

2010-10-12 Thread Greg Snow
If you just want to limit the plot, then specify xlim and ylim in the plot call and everything outside of those ranges will be silently ignored in the plotting. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Mes

Re: [R] Extracting data subset for plot

2010-10-12 Thread Gavin Simpson
On Tue, 2010-10-12 at 11:44 +0800, elaine kuo wrote: > Dear list, > I want to make a plot based on the following information, using the command > plot. > > variable A for x axis : temperature (range: -20 degrees to 40 degree) > > variable B for y axis : altitude (range: 50 m to 2500 m ) Use the

Re: [R] Extracting data from a list of matrices

2010-01-14 Thread Hubert Colt
Excellent! That did the trick. Thank you very much. On Thu, Jan 14, 2010 at 5:27 PM, Henrique Dallazuanna wrote: > Try this: > > lapply(l, '[', 1, 1) > > > On Thu, Jan 14, 2010 at 2:22 PM, Hubert Colt > wrote: > > Hi, > > > > Apologies in advance for the basic nature of my question. I am still v

Re: [R] Extracting data from a list of matrices

2010-01-14 Thread Henrique Dallazuanna
Try this: lapply(l, '[', 1, 1) On Thu, Jan 14, 2010 at 2:22 PM, Hubert Colt wrote: > Hi, > > Apologies in advance for the basic nature of my question. I am still very > much a rookie when it comes to R. Having googled it, checked Nabble and > trial/error to the best of my ability, I have yet to

Re: [R] extracting data from a list of unformatted text files

2008-11-20 Thread ravi
lt;[EMAIL PROTECTED]> Cc: r-help@r-project.org Sent: Thursday, 20 November, 2008 14:35:10 Subject: Re: [R] extracting data from a list of unformatted text files Here is a way to process the file.  You will have to add the loop, error checking, piecing multiple files together, and determination of th

Re: [R] extracting data from a list of unformatted text files

2008-11-20 Thread jim holtman
Here is a way to process the file. You will have to add the loop, error checking, piecing multiple files together, and determination of the end of the data: > x <- "I give below a sample of the kind of the information in the text file : + + #(a lot of preceding text) + 2008-10-01 06

Re: [R] Extracting data from Eigen function

2008-03-03 Thread Rolf Turner
Use mat <- eig[["vectors"]] If x is a list, ``x[i]'' gives you a (sub-) list of length 1, whereas ``x[[i]]'' gives you the single element of that list. A possibly subtle but important distinction. cheers, Rolf Turner On 4/03/2008, at 12:42 PM, SS-R wrote: > > H

Re: [R] extracting data using strings as delimiters

2007-09-26 Thread lucy b
All great ideas. I tried strsplit first and it worked, but thanks everyone! Best- LB On 9/25/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Perhaps you could clarify what the general rule is but assuming > that what you want is any word after a colon it can be done with > strapply in the gsu

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Gabor Grothendieck
Perhaps you could clarify what the general rule is but assuming that what you want is any word after a colon it can be done with strapply in the gsubfn package like this: Lines <- c("Year Built: 1873 Gross Building Area: 578 sq ft", "Total Rooms: 6 Living Area: 578 sq ft") library(gsubfn) str

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Ted Harding
On 25-Sep-07 20:39:11, lucy b wrote: > Dear List, > > I have an ascii text file with data I'd like to extract. Example: > > Year Built: 1873 Gross Building Area: 578 sq ft > Total Rooms: 6 Living Area: 578 sq ft > > There is a lot of data I'd like to ignore in each record, so I'm > hoping th

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread jim holtman
Here is one way. You can setup a list of the patterns to match against and then apply it to the string. I am not sure what the rest of the text file look like, but this will return all the values that match. > x <- readLines(textConnection("Year Built: 1873 Gross Building Area: 578 sq > ft +

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Marc Schwartz
On Tue, 2007-09-25 at 16:39 -0400, lucy b wrote: > Dear List, > > I have an ascii text file with data I'd like to extract. Example: > > Year Built: 1873 Gross Building Area: 578 sq ft > Total Rooms: 6 Living Area: 578 sq ft > > There is a lot of data I'd like to ignore in each record, so I'm

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Katharine Mullen
have you seen help(strsplit)? On Tue, 25 Sep 2007, lucy b wrote: > Dear List, > > I have an ascii text file with data I'd like to extract. Example: > > Year Built: 1873 Gross Building Area: 578 sq ft > Total Rooms: 6 Living Area: 578 sq ft > > There is a lot of data I'd like to ignore in each