Hi Andrew,
thanks a lot, that fully explains it.
Sorry for the HTML text. For the record I put the original code again
below.
Best regards
Hilmar
On 27.10.22 18:34, Andrew Simmons wrote:
> $ does not evaluate its second argument, it does something like
> as.character(substitute(name)).
>
> Yo
Your message is garbled. Please send plain text to the mailing list.
On October 27, 2022 2:31:47 AM PDT, Hilmar Berger wrote:
>Dear all,
>
>I'm a little bit surprised by the behavior of the $ operator when used
>in lapply - any indication what might be wrong is appreciated.
>
>> xx = list(A=list(
$ does not evaluate its second argument, it does something like
as.character(substitute(name)).
You should be using
lapply(list, function(x) x$a)
or
lapply(list, `[[`, "a")
On Thu, Oct 27, 2022, 12:29 Hilmar Berger wrote:
> Dear all,
>
> I'm a little bit surprised by the behavior of the $ o
Dear all,
I'm a little bit surprised by the behavior of the $ operator when used
in lapply - any indication what might be wrong is appreciated.
> xx = list(A=list(a=1:3, b=LETTERS[1:3]),"B"=list(a=7:9, b=LETTERS[7:9])) >
> lapply(xx,`$`,"a") $A NULL $B NULL > `$`(xx[[1]],"a") [1] 1 2 3 >
lapply
Thans Richard, it works well. --- Kai
On Monday, December 13, 2021, 04:00:33 AM PST, Richard O'Keefe
wrote:
You want to DELETE rows satisfying the condition P & Q.The subset() function
requires an expression saying whatyou want to RETAIN, so you need subset(PD,
!(P & Q)).
test <- subs
You want to DELETE rows satisfying the condition P & Q.
The subset() function requires an expression saying what
you want to RETAIN, so you need subset(PD, !(P & Q)).
test <- subset(PD, !(Class == "1st" & Survived == "No"))
By de Morgan's laws, !(P & Q) is the same as (!P) | (!Q)
so you could als
Use one ampersand, not two.
And post plain text.
On December 12, 2021 8:30:11 PM PST, Kai Yang via R-help
wrote:
>Hi R team,I want to delete records from a data frame if Class = '1st' and
>Survived = 'No'. I wrote the code below, test <- subset(PD, Class != '1st' &&
>Survived != 'No')
>but th
Hi R team,I want to delete records from a data frame if Class = '1st' and
Survived = 'No'. I wrote the code below, test <- subset(PD, Class != '1st' &&
Survived != 'No')
but the code return a wrong result. Can someone help me for this?
Thanks,Kai
[[alternative HTML version deleted]]
___
I assume that prim, etc. are columns of your data frame, mydata. Ergo, the
error message "prim not found" as 'prim' etc. does not exist in the Global
environment.
exclude <- with(mydata, prim == -9, etc. ) should get what you want to
evaluate your second subset statement if I have understood corre
Thanks. YES the second call to subset is there, trying to use my failed
definition of "exclude". Read on..
On 2021/10/16 上午 09:35, Jeff Newmiller wrote:
I don't see a "second one". Looks like you forgot the subset function call?
On October 15, 2021 6:23:56 PM PDT, Steven Yen wrote:
The follo
I don't see a "second one". Looks like you forgot the subset function call?
On October 15, 2021 6:23:56 PM PDT, Steven Yen wrote:
>The following "subset command works. I was hoping the second would as
>well but it does not.
>
>My definition of exclude is rejected.
>
>Help please? Thanks.
>
> > m
The following "subset command works. I was hoping the second would as
well but it does not.
My definition of exclude is rejected.
Help please? Thanks.
> mydata<-subset(mydata,
+ prim>-9 & highsch>-9 & tert>-9 &
+ govt>-9 & nongovt>-9 &
+ m
I solve this as follows
m2 <- subset(m1,`Classification Description`=="Borrowing from the Public" |
`Classification Description`=="By Other Means" | `Classification
Description`=="Total Surplus (+) or Deficit (-)")
sincerely
Engin YILMAZ
Engin Yılmaz , 29 Tem 2020 Çar, 16:57 tarihinde şunu
yazd
Hello,
Try %in% instead of == in:
m2<-m1[m1$`Classification Description` == levels(m1$`Classification
Description`)[c(1,15,2,4],]
Hope this helps,
Rui Barradas
Às 14:57 de 29/07/2020, Engin Yılmaz escreveu:
Dear
I try to create a new subset from my dataframe.
My dataframe's name is m1.
Dear Engin,
On 2020-07-29 16:57 +0300, Engin Yılmaz wrote:
> Dear
>
> I try to create a new subset from my dataframe.
> My dataframe's name is m1.
> "Classification Description" column has 15 different factors.
> The following code is used creating a subset for 1 factor.
> m2<-m1[m1$`Classificati
Dear
I try to create a new subset from my dataframe.
My dataframe's name is m1.
"Classification Description" column has 15 different factors.
The following code is used creating a subset for 1 factor.
m2<-m1[m1$`Classification Description` == levels(m1$`Classification
Description`)[1],]
My aim is
-Original Message-
> From: R-help On Behalf Of Bert Gunter
> Sent: Tuesday, January 14, 2020 8:10 AM
> To: ani jaya
> Cc: r-help
> Subject: Re: [R] Subset a data frame with specific date
>
> That's fine, but do note that the which() function is wholly unnecessary
in
Thank you Bert.
And yes another topic to study.
On Tue, Jan 14, 2020 at 4:10 PM Bert Gunter wrote:
>
> That's fine, but do note that the which() function is wholly unnecessary in
> your last line as R allows logical indexing. Perhaps another topic you need
> to study.
>
> -- Bert
>
>
>
> On Mon
That's fine, but do note that the which() function is wholly unnecessary in
your last line as R allows logical indexing. Perhaps another topic you need
to study.
-- Bert
On Mon, Jan 13, 2020 at 10:56 PM ani jaya wrote:
> Dear Jeff and Bert,
>
> Thank you very much for your correction and expl
Dear Jeff and Bert,
Thank you for your correction and explanation.
Yes, I need more study regarding date format and
sorry for HTML mail.
I was able to subset data that I want.
mjo30<-read.table("rmm.txt", header=FALSE, skip=4234, nrows=10957)
mjo30$V8<-NULL
names(mjo30)<-c("year","month","day",
Dear Jeff and Bert,
Thank you very much for your correction and explanation.
And yes, I need to study about date format more.
Sorry for HTML mail, don't realize.
I was able to subset the data that I want.
mjo30<-read.table("rmm.txt", header=FALSE, skip=4234, nrows=10957)
mjo30$V8<-NULL
names(mjo
Inline.
Bert Gunter
On Mon, Jan 13, 2020 at 8:54 PM ani jaya wrote:
> Good morning R-Help,
>
> I have a dataframe with 7 columns and 1+ rows. I want to subset/extract
> those data frame with specific date (not in order). Here the head of my
> data frame:
>
> head(mjo30)
> year month d
The dput function is for re-creating an R object in another R workspace, so it
uses fundamental base types to define objects. A Date is really the number of
days since a specific date (typically 1970-01-01) that get converted to look
like dates whenever you display or print them, so what you are
Good morning R-Help,
I have a dataframe with 7 columns and 1+ rows. I want to subset/extract
those data frame with specific date (not in order). Here the head of my
data frame:
head(mjo30) year month date rmm1 rmm2 phase amp
1 1986 11 -0.326480 -1.55895 2 1.59277
2 1
Look at the help docs and examples for textcat and sapply:
print(as.character(data$x[sapply(data$x, textcat)=="english"]))
Although textcat defaults classify "This book is amazing" as dutch, so
you may want to read the help for textcat and change the profile db
("p") or "method".
On 19/11/20
Hi all,
How is it possible to subset English text from a df containing German and
English texts using textcat package?
> library(textcat)
> dput(data)
structure(list(x = structure(c(2L, 6L, 5L, 3L, 1L, 4L), .Label = c("Dieses
Buch ist erstaunlich",
"I love this book", "ich
Do you also want lines 38 and 39 (in addition to 40:44), or do I
misunderstand your problem?
When you deal with runs of data, think of the rle (run-length encoding)
function. E.g. here is
a barely tested function to find runs of a given minimum length and a given
difference between
successive val
Hi Jim,
thank's it is working with the given example,
but whats the difference when using
testdata=data.frame(TIME=c("17:11:20", "17:11:21", "17:11:22",
"17:11:23", "17:11:24", "17:11:25", "17:11:26", "17:11:27", "17:11:28",
"17:21:43",
"17:22:16", "17:22:19", "18:04:48"
Bugger! It's
eval(parse(text=paste0("kkdf[c(",paste(starts,ends,sep=":",collapse=","),"),]")))
What a mess!
Jim
On Fri, Sep 28, 2018 at 8:35 AM Jim Lemon wrote:
>
> Hi Knut,
> As Bert said, you can start with diff and work from there. I can
> easily get the text for the subset, but despite fool
Hi Knut,
As Bert said, you can start with diff and work from there. I can
easily get the text for the subset, but despite fooling around with
"parse", "eval" and "expression", I couldn't get it to work:
# use a bigger subset to test whether multiple runs can be extracted
kkdf<-subset(airquality,Te
1. I assume the values are integers, not floats/numerics (which woud make
it more complicated).
2. Strategy: Take differences (e.g. see ?diff) and look for >3 1's in a
row.
I don't have time to work out details, but perhaps that helps.
Cheers,
Bert
Bert Gunter
"The trouble with having an open
Hi to all
I need a subset for values if there are f.e 3 values successive in a
column of a Data Frame:
Example from the subset help page:
subset(airquality, Temp > 80, select = c(Ozone, Temp))
29 45 81
35 NA 84
36 NA 85
38 29 82
39 NA 87
40 71 90
41 39
Dear David,
Subsetting works but the 'date' information is lost in the new file.
Thanks, Mike. I was not aware of the bug but will work on learning
about (getZ) and (setZ). Thanks again!
Sincerely,
Milu
On Tue, Jun 19, 2018 at 7:32 AM, Michael Sumner wrote:
>
>
> On Mon, 18 Jun 2018, 22:09 D
On Mon, 18 Jun 2018, 22:09 David Winsemius, wrote:
>
>
> > On Jun 18, 2018, at 7:21 AM, Miluji Sb wrote:
> >
> > Dear all,
> >
> > I have a rasterbrick with the date/time information provided which I
> would
> > like to subset by year.
> >
> > However, when I use the following code for sub-setti
> On Jun 18, 2018, at 7:21 AM, Miluji Sb wrote:
>
> Dear all,
>
> I have a rasterbrick with the date/time information provided which I would
> like to subset by year.
>
> However, when I use the following code for sub-setting;
>
> new_brick <- subset(original, which(getZ( original ) >= as.D
Dear all,
I have a rasterbrick with the date/time information provided which I would
like to subset by year.
However, when I use the following code for sub-setting;
new_brick <- subset(original, which(getZ( original ) >= as.Date("2000-01-01
10:30:00") & getZ(original ) <= as.Date("2014-12-31 10
You realize, do you not, that in fact there are no numbers in your "list"
(actually a vector).
It looks like you would do well to spend some time with an R tutorial or
two before posting further to this list. We can help, but cannot substitute
for the basic knowledge that you would gain from doin
Super, thanks Boris. Top notch :-)
On Mon, Sep 25, 2017 at 1:05 PM, Boris Steipe
wrote:
> Always via logical expressions. In this case you can use the logical
> expression
>
> myDF$b != "0"
>
> to give you a vector of TRUE/FALSE
>
>
>
> B.
>
>
> > On Sep 25, 2017, at 8:00 AM, Shane Carey wrote
Always via logical expressions. In this case you can use the logical expression
myDF$b != "0"
to give you a vector of TRUE/FALSE
B.
> On Sep 25, 2017, at 8:00 AM, Shane Carey wrote:
>
> This is super, really helpfull. Sorry, one final question, lets say I wanted
> to remove 0's rather t
This is super, really helpfull. Sorry, one final question, lets say I
wanted to remove 0's rather than NAs , what would it be?
Thanks
On Mon, Sep 25, 2017 at 12:41 PM, Boris Steipe
wrote:
> myDF <- data.frame(a = c("<0.1", NA, 0.3, 5, "Nil"),
>b = c("<0.1", 1, 0.3, 5, "Nil")
myDF <- data.frame(a = c("<0.1", NA, 0.3, 5, "Nil"),
b = c("<0.1", 1, 0.3, 5, "Nil"),
stringsAsFactors = FALSE)
# you can subset the b-column in several ways
myDF[ , 2]
myDF[ , "b"]
myDF$b
# using the column, you make a logical vector
! is.na(as.numeric(myDF
Hi,
Lets say this was a dataframe where I had two columns
a <- c("<0.1", NA, 0.3, 5, "Nil")
b <- c("<0.1", 1, 0.3, 5, "Nil")
And I just want to remove the rows from the dataframe where there were NAs
in the b column, what is the syntax for doing that?
Thanks in advance
On Fri, Sep 22, 2017 at
Super,
Thanks
On Fri, Sep 22, 2017 at 4:57 PM, Boris Steipe
wrote:
> > a <- c("<0.1", NA, 0.3, 5, "Nil")
> > a
> [1] "<0.1" NA "0.3" "5""Nil"
>
> > b <- as.numeric(a)
> Warning message:
> NAs introduced by coercion
> > b
> [1] NA NA 0.3 5.0 NA
>
> > b[! is.na(b)]
> [1] 0.3 5.0
>
>
>
> a <- c("<0.1", NA, 0.3, 5, "Nil")
> a
[1] "<0.1" NA "0.3" "5""Nil"
> b <- as.numeric(a)
Warning message:
NAs introduced by coercion
> b
[1] NA NA 0.3 5.0 NA
> b[! is.na(b)]
[1] 0.3 5.0
B.
> On Sep 22, 2017, at 11:48 AM, Shane Carey wrote:
>
> Hi,
>
> How do I extract just n
Hi,
How do I extract just numbers from the following list:
a=c("<0.1",NA,0.3,5,Nil)
so I want to obtain: 0.3 and 5 from the above list
Thanks
--
Le gach dea ghui,
*Shane Carey*
*GIS and Data Solutions Consultant*
[[alternative HTML version deleted]]
Hi Elise,
One of the quirks of POSIXt time values is that they are lists. This
should give you the plot:
plot(Soil_Temp~as.numeric(DateTime),eldf,xaxt="n",xlab="DateTime")
and this the x axis:
axis.POSIXct(1,eldf$DateTime)
If you want a different format for the date values on the axis, look
at
Hi Elise,
If I create a CSV file like your example and read it into a data frame:
eldf<-read.csv("el.csv")
Then convert the first field to POSIXt dates:
eldf$DateTime<-strptime(eldf$DateTime,"%Y-%m-%d %H:%M:%S")
class(eldf$DateTime)
[1] "POSIXlt" "POSIXt"
I can subset the file like this:
time_
Hi Elise,.
I would ask:
class(data$DateTime)
and see if it returns:
"POSIXct" "POSIXt"
Jim
On Sat, Jan 21, 2017 at 3:02 AM, Elise LIKILIKI
wrote:
> Hello,
>
> I have a dataset containing Date Time, Air Temperature, PPFD, Sol
> Temperature...
> The first data are false so I would like to extr
How are we supposed to help you if you don’t read the Posting Guide and don’t
provide any information about the classes of columns in `data`.?
— David.
> On Jan 20, 2017, at 10:02 AM, Elise LIKILIKI wrote:
>
> Hello,
>
> I have a dataset containing Date Time, Air Temperature, PPFD, Sol
> Te
Hello,
I have a dataset containing Date Time, Air Temperature, PPFD, Sol
Temperature...
The first data are false so I would like to extract the other ones.
I've tried :
>data1<-subset(data,DateTime>=as.POSIXct("2017-01-10
11:00:00",format="%Y-%m-%d
%H:%M:%S"),select=c(DateTime,PPFD_Avg,Air_Temp_Av
Ashta,
## I may have misunderstood your question and if so I apologize.
## I had to remove the extra line after "45" before
## the ",sep=" to use your code.
## You could have used dput(dat) to send a more reliable (robust) version.
dat <- structure(list(ID = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L,
For the data you provide, it's simply:
summary(subset(dat, x1 == "x" & x2 == "z")$y)
Note that x1 and x2 are factors in your example.
We also don't know what you want to do if there are more than one
combination of that per ID, or if there ID values with no matching
rows.
Sarah
On Fri, Oct 14,
Hi all,
I am trying to summarize big data set by selecting a row
conditionally. and tried to do it in a loop
Here is the sample of my data and my attempt
dat<-read.table(text=" ID,x1,x2,y
1,a,b,15
1,x,z,21
1,x,b,16
1,x,k,25
2,d,z,31
2,x,z,28
2,g,t,41
3,h,e,32
3,x,z,38
3,x,g,45
",sep=",",he
>If you want to drop levels, use droplevels() either on the factor or on
the >subset of your data frame. Example:
>droplevels(f[1]) #One element, only one level
Calling factor() on a factor, as the OP did, also drops any unused levels,
as the examples showed.
> str(factor(factor(letters)[11:13]))
> You did not change df$quant - you made a new object called 'subdf'
> containing a column called 'quant' that had only one level. Changing subdf
> has
> no effect on df.
Also, subsetting a factor _intentionally_ does not change the number of levels.
Example:
f <- factor(sample(letters[1:3], 30
You did not change df$quant - you made a new object called 'subdf'
containing a column called 'quant' that had only one level. Changing
subdf has no effect on df.
> df <- data.frame(quant=factor(letters))
> str(df)
'data.frame': 26 obs. of 1 variable:
$ quant: Factor w/ 26 levels "a","b","c",
Hello,
Don't use subset, use indexing.
subdf <- df[df$quant %in% "VeryFast", ]
By the way, instead of %in% you can use ==, since you're interested in
just one value of quant.
Hope this helps,
Rui Barradas
Citando ch.elahe via R-help :
> Hi all,
> I have the following df and I want to know
Hi all,
I have the following df and I want to know which Protocols are VeryFast, which
are FAST, which are SLOW and also which ones are VerySLOW :
$ Protocol : Factor w/ 48 levels "DP FS QTSE SAG",..: 5 5 28 5 5 5 7 7
47 5 ...
$ quant : Factor w/ 4 levels "FAST","SLOW",.
This is quite a different question. I suggest you start a new post with a
new subject line for this. And I suggest you include code for an example
plot that you want to use.
Otherwise, you might look here for some ideas on how to control colors in a
scatter plot using base r, http://stackoverflo
Thanks Jean, Does anyone know how to set these [hast1] and [hast2] as the
colors of a plot?
On Friday, April 22, 2016 7:39 AM, "Adams, Jean" wrote:
You can use the grepl() function to give you logicals for each criterion, then
combine them as needed. For example:
# example version of Co
You can use the grepl() function to give you logicals for each criterion,
then combine them as needed. For example:
# example version of Command
Command <- paste0("_localize_", c("PD","t2","t1_seq", "abc", "xyz",
"PD_t1"))
hasPD <- grepl("PD", Command, fixed=TRUE)
hast1 <- grepl("t1", Command, f
You may investigate a solution based on regular expressions.
Some tutorials to help:
http://www.regular-expressions.info/rlanguage.html
http://www.endmemo.com/program/R/grep.php
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SvetlanaEdenRFiles/regExprTalk.pdf
https://rstudio-pubs-static.s3.ama
Hi all,
I have a data frame df and I want to do subset based on several conditions of
letters of the names in Command.1)if the names contain PD 2)if the names
contain t1 3)if the names contain t2 4)if the names contain t1 and PD 5)if the
names contain t2 and PD 6)otherwise the names would be
n used to replace
>>> all
>>> > the entries but keep the attributes.
>>> >
>>> > and actually you function construction works with empty index
>>> >
>>> > > x<-c(1,2,5)
>>> > > letters[x]
>>> > [1] "a" "b&qu
>> > > letters[]
>> > [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q"
>> > "r&q
"e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q"
> > "r" "s"
> > [20] "t" "u" "v" "w" &qu
w" "x" "y" "z"
>
> It is sometimes useful not "expect" the program behavior but "inspect" why
> it behaves differently.
>
> If you want your function to throw error when some arguments are missing
> you need to do the check y
quot; "u" "v" "w" "x" "y" "z"
It is sometimes useful not "expect" the program behavior but "inspect" why it
behaves differently.
If you want your function to throw error when some arguments are missing you
need to do
Hi all,
I'm guessing what's the rationale behind this:
> subsettingFun <- function(vec, ix) vec[ix]
> subsettingFun(letters, c(1,2,5))
[1] "a" "b" "e"
> subsettingFun(letters)
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q"
"r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
If the
t;V046", "V047", "V048", "V049", "V050", "V051", "V052",
"V053", "V054", "V055", "V056", "V057"), class = "factor"), linecode =
structure(c(1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
m1 <- c()
> x <- length(plot.id)
> for (i in (1:x)) {
> m1 <- as.numeric(strsplit(as.character(dataset$ranges2use),
> ",")[[i]])
> }
> m2
> }
>
> I am not sure where I am making a mistake.
> Thanks.
> Nilesh
&g
lit(as.character(dataset$ranges2use),
",")[[i]])
}
m2
}
I am not sure where I am making a mistake.
Thanks.
Nilesh
-Original Message-
From: Michael Dewey [mailto:li...@dewey.myzen.co.uk]
Sent: Monday, November 23, 2015 12:11 PM
To: DIGHE, NILESH [AG/2362]; r-help@r-pro
er 23, 2015 10:17 AM
To: DIGHE, NILESH [AG/2362]; r-help@r-project.org
Subject: Re: [R] subset data using a vector
length(strsplit(as.character(mydata$ranges2use), ","))
was that what you expected? I think not.
On 23/11/2015 16:05, DIGHE, NILESH [AG/2362] wrote:
Dear R users,
NILESH [AG/2362]; r-help@r-project.org
Subject: Re: [R] subset data using a vector
length(strsplit(as.character(mydata$ranges2use), ","))
was that what you expected? I think not.
On 23/11/2015 16:05, DIGHE, NILESH [AG/2362] wrote:
> Dear R users,
> I like to split
length(strsplit(as.character(mydata$ranges2use), ","))
was that what you expected? I think not.
On 23/11/2015 16:05, DIGHE, NILESH [AG/2362] wrote:
Dear R users,
I like to split my data by a vector created by using variable "ranges".
This vector will have the current range (r
Dear R users,
I like to split my data by a vector created by using variable
"ranges". This vector will have the current range (ranges), preceding range
(ranges - 1), and post range (ranges + 1) for a given plotid. If the preceding
or post ranges in this vector are outside the l
On Tue, 30 Jun 2015, Rolf Turner wrote:
If you want a pointer to the correct syntax for subset(), try
help("subset")!!!
The syntax of your "extstream" function is totally screwed up, convoluted and
over-complicated. Note that even if you had your "subset" argument specified
correctly, the re
If you want a pointer to the correct syntax for subset(), try
help("subset")!!!
The syntax of your "extstream" function is totally screwed up,
convoluted and over-complicated. Note that even if you had your "subset"
argument specified correctly, the return() call will give you only the
resu
On Mon, 29 Jun 2015, David Winsemius wrote:
No. A pointer to the correct use of "[" is needed.
Thanks, David. This puts me on the the right path.
Much appreciated,
Rich
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https:/
On Tue, 30 Jun 2015, Steve Taylor wrote:
Using return() within a for loop makes no sense: only the first one will be
returned.
Steve,
Mea culpa. Didn't catch that.
How about:
alldf.B = subset(alldf, stream=='B') # etc...
I used to do each stream manually, like the above, and want to
On Jun 29, 2015, at 5:03 PM, Rich Shepard wrote:
> Moving from interactive use of R to scripts and functions and have bumped
> into what I believe is a problem with variable names. Did not see a solution
> in the two R programming books I have or from my Web searches. Inexperience
> with ess-tra
Well, your code is, ah, too incorrect to convey what you want out of this
effort. If I were to guess based on your description, you want all of the data,
not a subset. An example data frame containing what you hope to extract might
be helpful.
However, extracting subsets is rarely done for just
Steve
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rich Shepard
Sent: Tuesday, 30 June 2015 12:04p
To: r-help@r-project.org
Subject: [R] Subset() within function: logical error
Moving from interactive use of R to scripts and functions and have bumped
i
Moving from interactive use of R to scripts and functions and have bumped
into what I believe is a problem with variable names. Did not see a solution
in the two R programming books I have or from my Web searches. Inexperience
with ess-tracebug keeps me from refining my bug tracking.
Here's a
Hi,
it seems not possible to susbset a svydesign object (DBI svydesign) and use
variables to make the subset expression
uff<-c("14","15")
for (i in 1:length(uff))
{
subpnad<-subset(pnad, uf==uff[i] & v0302=='4')
}
the error is the following
Error in sqliteSendQuery(con, statement, bind.data)
, 2, 2, 2, 2, 2, 2, 2, 2, 2), Wgt =
>> c(0.0043574552083,
>> 0.0043574552083, 0.0043574552083, 0.0043574552083,
>> 0.0043574552083, 0.0043574552083, 0.0043574552083,
>> 0.0043574552083, 0.0043574552083, 0.004357455208
83, 0.0043574552083,
> 0.0043574552083), SPCLORatingValue = c(14L, 15L, 15L,
> 12L, 15L, 12L, 13L, 15L, 14L, 15L, 14L)), .Names = c("WgtBand",
> "Wgt", "SPCLORatingValue"), row.names = 12:22, class = "data.frame"),
> V10 = stru
2, 2, 2, 2, 2,
2, 2, 2), Wgt = c(0.0043574552083, 0.00435745520833333,
0.0043574552083, 0.0043574552083, 0.0043574552083,
0.0043574552083, 0.0043574552083, 0.0043574552083,
0.0043574552083, 0.0043574552083, 0.0043574552083
), SPCLORatingVal
Can you show a small self-contained example of you data and expected
results?
I tried to make one and your expression returned a single number in a 1 by
1 matrix.
library(doBy)
Generation<-list(
data.frame(Wgt=c(1,2,4), SPCLORatingValue=c(10,11,12)),
data.frame(Wgt=c(8,16), SPCLORatingValue=
On 20/05/2015 7:13 PM, Vin Cheng wrote:
> Hi,
>
> I'm trying to group rows in a dataframe with SPCLORatingValue factor >16 and
> summing the Wgt's that correspond to this condition. There are 100
> dataframes in a list.
>
> Some of the dataframes won't have any rows that have this conditio
Hi,
I'm trying to group rows in a dataframe with SPCLORatingValue factor >16 and
summing the Wgt's that correspond to this condition. There are 100 dataframes
in a list.
Some of the dataframes won't have any rows that have this condition
SPCLORatingValue>16 and therefore no corresponding
> -Original Message-
> A consulting client has a large data set with a binary response
> (negative) and two factors (ctry and member) which have many levels, but
> many occur with very small frequencies. It is far too sparse with a model
> like
> glm(negative ~ ctry+member, family=binom
X 77840-4352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Friendly
Sent: Thursday, March 5, 2015 12:45 PM
To: R-help
Subject: [R] subset a data frame by largest frequencies of factors
A consulting client has a large data set with a binary response
A consulting client has a large data set with a binary response
(negative) and two factors (ctry and member) which have many levels,
but many occur with very small frequencies. It is far too sparse with a
model like glm(negative ~ ctry+member, family=binomial).
> str(Dataset)
'data.frame': 1
... nd nevermind, figured it out (from the final example on the
Extract.data.frame page):
`[.MyClass` <- function(x, i, ...) {
NextMethod("[")
mostattributes(RV) <- attribute(x)
RV
}
cheers,
-m
On Wed, Nov 12, 2014 at 11:02 PM, Murat Tasan wrote:
> And as a follow-up, I impleme
And as a follow-up, I implemented a barebones as.data.frame.MyClass(...).
It works when dealing with non-subsetted data frames, but fails upon a
subset(...) call:
> as.data.frame.MyClass <- function(x, ...) as.data.frame.vector(x, ...)
This works for a single column, e.g.:
> str(data.frame(MyCla
Hi all --- I've stumbled upon some pretty annoying behavior, and I'm
curious how others may have gotten around it.
When using subset(...) on a data frame that contains a custom S3
field, the class is dropped in the result:
> MyClass <- function(x) structure(x, class = "MyClass")
> df <- data.fram
Hi everyone
Since I updated package 'ffbase', subset.ffdf does not work with bit vectors
anymore. Here is a short example:
data(iris)
library(ffbase)
iris.ffdf <- as.ffdf(iris)
index <- sample(c(FALSE,TRUE), nrow(iris), TRUE)
index.bit <- as.bit(index)
subset(iris.ffdf, subset=index.bit)
resu
On Sep 4, 2014, at 2:58 PM, Kuma Raj wrote:
> This post has NOT been accepted by the mailing list yet.
Well, it has now. Were you earlier posting from Nabble? (Not an efficient
strategy.)
> I would like to subset a column based on the contents of a column with
> specific character. In the samp
This post has NOT been accepted by the mailing list yet.
I would like to subset a column based on the contents of a column with
specific character. In the sample data I wish to do the following:
First keep the data based on column "prog" if prog contains "ca", and
secondly to drop if race contains
1 - 100 of 525 matches
Mail list logo