Displaying 20 results from an estimated 300 matches similar to: "Can package plyr also calculate the mode?"
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;
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
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:
2008 Apr 03
1
prettyR 25% quartile, 75% quartile
I am using the describe function in prettyR. I would like to add the
25% 75% quartiles to the summary table
how do I do this
I have tried
describe(x.f, num.desc=c("mean", "median", "sd", "min", "max",
"skewness", "quantile(x.f, na.rm=T, probs=seq(0.25, 0.75))",
"valid.n"))
help
--
Let's not spend our time
2012 Nov 30
5
subset data frame by variable with missing value
Hello,
I have a variable in a data frame that contains NA values. I just want to
subset so that I get the obs where that variable is missing.
In SAS I would do:
data missing;
set test;
if myvalue=' ';
run;
How can I perform this simple task in R?
Thanks in advance for your help.
--
View this message in context:
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.
2024 Jun 12
3
my R code worked well when running the first 1000 lines of R code
Hi R users,
The following code worked well to summarize four data groups in a dataframe for three variables (t_depth, t_alt_count, t_alt_ratio), 12 columns of summary, see attached.
However, after running another 2000 lines of R codes using functions from more than 10 other R libraries, then it only generated one column of summary.
Do you know why?
Thank you,
Yuan Chun Ding
summary_anno1148ft
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
I am sorry that I know I should provide a dataset that allows to replicate my problem.
It is a research dataset and quite large, so I can not share.
Both Bert and Tim guessed my problem correctly. I also thought about the conflicting issue between different packages and function masking.
I just hope to that someone has similar experience, so providing me suggestion.
For conflicting issue,
2008 Jun 19
1
PrettyR (describe)
#is there a way to get NA in the table of descriptive statistics instead of
the function stopping Thank you in advance
#data
x.f <- structure(list(Site = structure(c(9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L), .Label = c("BC", "HC", "RM119", "RM148", "RM179",
"RM185",
2013 Sep 10
1
Error: BUG: Worker sent reply with id 393, expected 394
hi dovecot:
when i login 100 users with imap protocol ,Someusers appeared a BUG in maillog like :
Sep 10 09:05:22 auth(default): Error: BUG: Worker sent reply with id 393, expected 394
Sep 10 09:05:22 auth(default): Error: worker-server(q82 at t.com,10.12.80.3): Aborted: Worker is buggy
Sep 10 09:05:22 auth(default): Error: BUG: Worker sent reply with id 31, expected 32
Sep 10 09:05:22
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
Hello,
Inline.
?s 19:03 de 12/06/2024, Yuan Chun Ding via R-help escreveu:
> I am sorry that I know I should provide a dataset that allows to replicate my problem.
>
> It is a research dataset and quite large, so I can not share.
>
> Both Bert and Tim guessed my problem correctly. I also thought about the conflicting issue between different packages and function masking.
> I
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
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
Hi Rui,
Thank you very much!
Yes, I verified using real data, it worked correctly as expected after adding tidyr:: to the pivot_longer function and dplyr:: to the group_by and summarize
Function.
I did not know how to assign the tidyr and dplyr to the three functions because I do not really understand well the three functions and just got the code from a google search.
I also tried your
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
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
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
I sometimes think people on this list are quite rude to posters.
I'm afraid I'm likely to join in with some rudeness?
1. "Here is some code that works but also doesn't" is probably not going to
get you an answer
2. I provide no information about the data it works on or doesn't
3. I tell you I'm using a load of dependencies, but don't tell you what
4. I refer to