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

[R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
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 command. q <- p[1:20] But I want to extract the first 20 observations using

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

[R] Extracting data and saving in excel

2020-10-23 Thread bgnumis bgnum
Hi all, I have a dataframe call "data", and have lots of rows. One of them is data$`birth` my data has been imported from an excel file in RSTUDIO I want to obtain in a function all rows (with the names) where data$`birth` is bigger than 1979/01/01 and extract in a excel file as an output (a sub

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

[R] Extracting data from list of lists of dataframes

2020-05-27 Thread H
I am a newcomer to R and have been struggling with the following problem: I have a list1(1:N) containing a list2(1:2) each containing dataframes with the same column names but different number of rows. Both lists are named and the rows and the columns in the dataframe are named. I then would lik

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

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

2019-02-25 Thread Montgomery, Nigel
Hi there, I've tried several different ways to do the above (see attempts below) and none have been successful. From my internet searches this would appear to be a common problem. Any pointers would be appreciated. Attempt 1: zip_file_loc <- "xx/yy/zipfile.zip" data <- read_csv(unzip(zip_file_loc)

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

[R] Extracting data from density plots

2014-06-13 Thread Parimal Lokhande
I have a dataframe ​df ​ with 3 columns. Details ​of df are ​ as follows > summary(df) DateTestVartype Min. :2002-05-10 00:00:00 Min. :-3.8531 Bottom: 313 1st Qu.:2005-05-09 12:00:00 1st Qu.:-0.7773 Other :2501 Median :2008-05-07 00:

Re: [R] Datamatrix in R - extracting data from scatterplot

2013-08-16 Thread David Winsemius
On Aug 15, 2013, at 11:45 AM, BoonFei Tan wrote: > Say I have a dataframe for plotting scatterplot. The dataframe would be > organized in the following fashion (in CSV format): > > name ABC EFG132 45256 67 > to, say 200 000 entries > > I am going to first do a scatterplot, after which

[R] Datamatrix in R - extracting data from scatterplot

2013-08-15 Thread BoonFei Tan
Say I have a dataframe for plotting scatterplot. The dataframe would be organized in the following fashion (in CSV format): name ABC EFG132 45256 67 to, say 200 000 entries I am going to first do a scatterplot, after which I am going to subset a portion of the dataset into A using alpha

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
ames(johnAgg)[3] <- 'distance' merge(johnAgg, johnData) HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of rjb Sent: Friday, 24 August 2012 9:19 a.m. To: r-help@r-project.org Subject: [R] Extracting da

[R] Extracting data from dataframe with tied rows

2012-08-23 Thread rjb
Hi R help, I'm a fairly experienced R user but this manipulation has me stumped, please help: DATA 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) I have a dataset with records of individuals (id) , each with a di

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

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

2012-03-11 Thread frauke
Dear R community, I have the following problem I hoped you could help me with. My data is save in thousand of files with a weird extension containing for numbers and a z. For example *.1405z. With list.files I managed to load this data into R. It looks like this (the row numbers are not in the

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

[R] Extracting data from a zoo by date

2012-03-06 Thread Mago84
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 16.9340 01/09/08 37.9220 17.6655 The na

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

[R] Extracting data from trellis object

2012-01-25 Thread tsippel
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), y=rep(seq(1,50,by=1), times=10)) histogram(d

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

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

2012-01-22 Thread dthomas
Hi, Can you extract data from a SQL server table based on parameters already in R? For example I have a list of unique patient IDs with latest hospitalisation date which I've processed in R. I need to join this data to other tables in SQL server. The tables in SQL server are too large to import wi

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: ##.#.

[R] Extracting Data from SQL Server

2012-01-09 Thread dthomas
Hi, I am new to R (and rusty on SQL!) and I'm trying to extract records from a SQL server database. I have a table of patient records (LoadPUS) which have three code columns which i want to evaluate against a list of particular codes (CVD_ICD$ table). Given the size of the patient table I want to

Re: [R] Extracting data by row

2011-10-29 Thread William Dunlap
un...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Vinny Moriarty > Sent: Friday, October 28, 2011 6:05 PM > To: r-help@r-project.org > Subject: [R] Extracting data by row > > Thanks everyone for you help with my last question, and now I have one las

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

[R] Extracting data by row

2011-10-28 Thread Vinny Moriarty
Thanks everyone for you help with my last question, and now I have one last one... Here is a sample of my data in .csv format site,time_local,time_utc,reef_type_code,sensor_type,sensor_depth_m,temperature_c 06,2006-04-09 10:20:00,2006-04-09 20:20:00,BAK,sb39, 2, 29.63 06,2006-04-09 10:40:00,2006

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

[R] extracting data

2011-06-28 Thread Ana Kolar
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 data set A after we exclude data of the data set B. Any idea how to do

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

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

2010-11-05 Thread Santosh Srinivas
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.0503189291168807, 0.00229628598547049, 0.112348434473647, 0.07600046962546

Re: [R] Extracting data subset for plot

2010-10-12 Thread Greg Snow
nal Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of elaine kuo > Sent: Monday, October 11, 2010 9:45 PM > To: r-help@r-project.org > Subject: [R] Extracting data subset for plot > > Dear list, > > > > I want t

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

[R] Extracting data subset for plot

2010-10-11 Thread elaine kuo
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 ) The data below 0 degree of X variable wants to be erased tentatively.

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

[R] Extracting data from a list of matrices

2010-01-14 Thread Hubert Colt
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 find an easy solution. I am currently working with a list of 5x5 matrices, and want to extract

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

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

2008-11-20 Thread ravi
Hi, I want to extract information from a number of text files in a folder. The files are named as : 82534.txt, 82555.txt, 8282787.txt etc. I give below a sample of the kind of the information in the text file : #(a lot of preceding text) 2008-10-01  06:30:12                2 of 3 pag

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

[R] Extracting data from Eigen function

2008-03-03 Thread SS-R
Hi I need to extract the data returned by Eigen to plot the eigenvectors. However, when I try and eigv = eigen(covariance); it returns an object with the matrices containing eigenvalues and vectors.. how can I extract the eigenvector matrix from this?? When I try mat = eig["vectors"] it returns a

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

[R] extracting data using strings as delimiters

2007-09-25 Thread lucy b
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 there is a way to use strings as delimiters to get the da