Displaying 20 results from an estimated 300 matches similar to: "subset data frame by variable with missing value"
2013 Apr 03
5
Can package plyr also calculate the mode?
I am trying to replicate the SAS proc univariate in R. I got most of the
stats I needed for a by grouping in a data frame using:
all1 <- ddply(all,"ACT_NAME", summarise, mean=mean(COUNTS), sd=sd(COUNTS),
q25=quantile(COUNTS,.25),median=quantile(COUNTS,.50),
q75=quantile(COUNTS,.75),
q90=quantile(COUNTS,.90), q95=quantile(COUNTS,.95),
q99=quantile(COUNTS,.99) )
2013 May 23
3
Removing rows w/ smaller value from data frame
Hello,
I have a column called max_date in my data frame and I only want to keep the
bigger values for the same activity. How can I do that?
data frame:
activity max_dt
A 2013-03-05
B 2013-03-28
A 2013-03-28
C 2013-03-28
B 2013-03-01
Thank you for your help
--
View this message in context:
2013 Apr 05
2
How to perform a grouped shapiro wilk test on dataframe
Hello,
I was wandering if it is possible to perform on a dataframe called 'all' a
shapiro wilk normality test for COUNTS by variable Group
ACTIVITY? Could it be done using plyer? I saw an eg that applies to an
array but not to a dataframe:
lapply(split(dataset1$Height,dataset1$Group),shapiro.test)
Any thoughts would be much appreciated.
My dataframe is in shape:
dat ACTIVIT
2012 Oct 10
3
How to replicate SAS by group processing in R
Hello,
I am trying to re-code all my programs from SAS into R.
In SAS I use the following code:
proc sort data=upper;
by tdate stock_symbol expire strike;
run;
data upper1;
set upper;
by tdate stock_symbol expire strike;
if first.expire then output;
rename strike=astrike;
run;
on the following data set:
tdate stock_symbol expiration strike
9/11/2012 C 9/16/2012
2012 Sep 18
4
Conditional operations in R
Hello,
I am a newbie to R coming from SAS background. I am trying to program the
following:
I have a monthly data frame with 2 variables:
client pct_total
A 15%
B 10%
C 10%
D 9%
E 8%
F 6%
G 4%
I need to come up w/ a monthly list of clients that make 50% or just above
it every month so I can pass them to the rest of the program.
2012 Oct 19
4
Creating a new by variable in a dataframe
Hello,
I have a dataframe w/ 3 variables of interest: transaction,date(tdate) &
time(event_tim).
How could I create a 4th variable (last_trans) that would flag the last
transaction of the day for each day?
In SAS I use:
proc sort data=all6;
by tdate event_tim;
run;
/*Create last transaction flag per day*/
data all6;
set all6;
by tdate event_tim;
last_trans=last.tdate;
Thanks
2012 Sep 13
3
Cannot install package xlsx
I get following error message:
trying URL
'http://cran.stat.ucla.edu/bin/windows/contrib/2.15/xlsx_0.4.2.zip'
Content type 'application/zip' length 365611 bytes (357 Kb)
opened URL
downloaded 357 Kb
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In
2012 Aug 31
2
Conditional merging in R & if then statement
1)I am wandering how the following SQL statement can be written in R language
w/o using sqldf:
create table detail2 as
select a.*
from detail a,
pdetail b
where a.TDATE=b.TDATE
and (a.STIM >= b.STIM and a.STIM <=b.MAXTIM)
2) when try if then in R it only applies to the 1st row & not to whole
dataset like in SAS. How do you get round that?
in SAS:
data summary;
set all1;
2012 Nov 13
1
Using lubridate to increment date by business days only
Hello,
I know how to increment a date by calendar date:
ticker$ldate <- ticker$tdate + days(5)
How do I increment it by business days only so that week-ends are not
counted?
So for example friday november 2 + 5days becomes friday november 9 & not
wednesday nov 7.
Thanks for your help.
--
View this message in context:
2012 Aug 24
1
if then in R versus SAS
I am new to R and I have the following SAS statements:
if otype='M' and ocond='1' and entry='a.Prop' then MOC=1;
else MOC=0;
How would I translate that into R code?
Thanks in advance
--
View this message in context: http://r.789695.n4.nabble.com/if-then-in-R-versus-SAS-tp4641225.html
Sent from the R help mailing list archive at Nabble.com.
2012 Sep 13
1
Paasing values to sqlQuery like SAS macro
Hello,
We lost our SAS licence & I am busy transfering my old SAS programs to R
environment. I am very new to R. In 1 program I was creating SAS macro
vars & passing them into a SQL query to run against the server. There are 3
variables firm, begindt, enddt. # of values for each varies month to month.
Is there anyway I could do the same thing in R & pass the afore mentioned
values
2013 Apr 12
2
Stat question: How to deal w/ negative outliers?
Hello all,
I have a question: I am using the interquantile method to spot outliers &
it gives me values of say 234 & -120 or for the higher & lower benchmarks.
I don't have any issues w/ the higher end. However I don't have any
negative values. My lowest possible value is 0. Should I consider 0 as an
outlier?
Thanks ahead for your thoughts
--
View this message in
2017 Jun 23
1
setReplaceMethod creates 'object' in the userworkspace
Hi,
I recognized that the function 'setReplaceMethod' is creating a
character vector in the user workspace having the name (e.g. "newClass")
of the class used as value. If you can sort out a mistake by myself, I
would like you to file a bug report.
BBFN,
Jonathan
setClass("newClass", representation(value="numeric"))
setMethod(f = "initialize",
2017 Jun 23
1
setReplaceMethod creates 'object' in the userworkspace
Hi,
I recognized that the function 'setReplaceMethod' is creating a
character vector in the user workspace having the name (e.g. "newClass")
of the class used as value. If you can sort out a mistake by myself, I
would like you to file a bug report.
BBFN,
Jonathan
setClass("newClass", representation(value="numeric"))
setMethod(f = "initialize",
2012 Jan 19
1
dataframe: how to select an element from a row
Hi,
I 'd like to select the Date where myvalue =1800 appears the* first time*.
For instance:
df =data.frame(date, myvalue, ...)
...
Date myvalue
2012-01-05 2500
2012-01-06 2450
*2012-01-07 1800*
2012-01-08 2200
2012-01-09 1800
I'd like to retrieve the third line.
I do
2005 Aug 04
4
An small suggestion for the R team
Hi all,
I would like to suggest that all R functions/etc like:
codes-deprecated
grid-internal
ns-alt
ns-dblcolon
ns-hooks
ns-internals
ns-lowlev
ns-reflect.Rd
tools-internal
ts-defunct
utils-deprecated
utils-internal
... and another
i.e, function/word separate for '-'
were all substituted by
codes_deprecated
grid_internal
ns_alt
2010 Feb 17
2
multi-argument returns
Dear R users,
I have multi-argument returns in a function and I am warned by the program
they are deprecated.
I have found this in the R-help archives :
http://tolstoy.newcastle.edu.au/R/help/01c/0319.html
http://tolstoy.newcastle.edu.au/R/help/01c/0356.html
Since I am not too good at programming, the list solution seems the better
one for me. It is also the one advocated by Kevin Murphy.
So
2010 Jan 15
2
[LLVMdev] [PATCH] - Union types, attempt 2
On 01/15/2010 11:37 AM, Talin wrote:
> Yes, that's closer to the frontend semantics: the variants of a
> union type don't have any natural ordering, so list semantics could
> cause problems.
I agree. I probably shouldn't even comment, as I know so little about
LLVM. But I've hand-written a couple kLOC of IR now and am starting to
get a feel for the
2009 Apr 22
2
Returning Variables in R to Linux Shell
If I have an R script that I am executing from a command line in linux,
do you know how I can return the value of the variable in my R script to
the linux environment without writing it to a file in my R script and
then reading the file through cat?
For example, if I had a simple one line R script that just did
string <- 'TEST',
when I call
/usr/local/bin/R
2013 Jan 28
5
[LLVMdev] Value* to Instruction*/LoadInst* casting
Hello everyone,
Can you please tell me if it is possible in LLVM to cast a `Value*` to an
`Instruction*/LoadInst*` if for example `isa<LoadInst>(MyValue)` is true?
In my particular piece of code:
Value* V1 = icmpInstrArray[i]->getOperand(0);
Value* V2 = icmpInstrArray[i]->getOperand(1);
if (isa<LoadInst>(V1) || isa<LoadInst>(V2)){
...