Val,
Working with R's special missing value indicator (NA) would be useful
here. You could use the na.strings arg in read.table() to recognise "-"
as a missing value:
dfr <- read.table( text=
'first week last
Alex1 West
Bob 1 John
Cory1 Jack
Cory2 -
Bob 2 John
Bob
ecdf() is part of the stats package, which is (typically)
automatically attached on startup.
I have no idea what you mean by "splitting" and "saving." This is
basically how all of R works -- e.g. see the value of lm() and the
(S3) plot method, plot.lm, for "lm" objects. This has nothing to do
wit
Hi Jeff and All,
When I examined the excluded data, ie., first name with with
different last names, I noticed that some last names were not
recorded
or instance, I modified the data as follows
DF <- read.table( text=
'first week last
Alex1 West
Bob 1 John
Cory1 Jack
Cory2
Hi Jeff,
Most likely the "Event Date" field is a factor. Try this:
df$Event.Date <- as.Date(as.character(df$Event.Date),
"%d-%b-%y")
Also beware of Excel's habit of silently converting mixed date formats
(i.e. dd/mm/ and mm/dd/) to one or the other format. The only
way I know to prevent
I want to split my computation into parts. The first script processes the
data, the second does the graphics. I want to save results of
time-consuming calculations. My example tried to simulate this by terminate
the session without saving it, so the environment was lost on purpose. What
confuses m
Sorry Jeff, I did not finish my email. I accidentally touched the send button.
My question was the
when I used this one
length(unique(result2$first))
vs
dim(result2[!duplicated(result2[,c('first')]),]) [1]
I did get different results but now I found out the problem.
Thank you!.
On S
Jeff:
Oh yes!-- and I meant to say so and forgot, so I'm glad you did. Not
only might the free variable in the function not be there; worse yet,
it might be there but something else. So it seems like a disaster
waiting to happen. The solution, I would presume, is to have no free
variables (make th
Your question mystifies me, since it looks to me like you already know the
answer.
--
Sent from my phone. Please excuse my brevity.
On February 12, 2017 3:30:49 PM PST, Val wrote:
>Hi Jeff and all,
> How do I get the number of unique first names in the two data sets?
>
>for the first one,
>
So doesn't the fact that a function contains a reference to an environment
suggest that this whole exercise is a really bad idea?
--
Sent from my phone. Please excuse my brevity.
On February 12, 2017 4:05:31 PM PST, Bert Gunter wrote:
>It worked fine for me:
>
>> t <- rnorm(100)
>> cdf <- ecdf(
R-Help Group
What is the proper way to convert excel date formats to R-Date format.
Event ID
Event Date
Event Type
250013
1-Jan-09
NSAG Attack
250015
1-Jan-09
NSAG Attack
250016
1-Jan-09
NSAG Attack
Obviously this is wrong
df$Event.Date <- as.Date(df$Event.Da
It worked fine for me:
> t <- rnorm(100)
> cdf <- ecdf(t)
>
> trans <- function(x) qnorm(cdf(x) * 0.99)
> saveRDS(trans, "/tmp/foo")
> trans(1.2)
[1] 1.042457
> trans1 <- readRDS("/tmp/foo")
> trans1(0)
[1] 0.1117773
Of course, if I remove cdf() from the global environment, it will fail:
> rm(c
Hi Jeff and all,
How do I get the number of unique first names in the two data sets?
for the first one,
result2 <- DF[ 1 == err2, ]
length(unique(result2$first))
On Sun, Feb 12, 2017 at 12:42 AM, Jeff Newmiller
wrote:
> The "by" function aggregates and returns a result with generally fewe
I can't figure out how to save functions to RDS file. Here is an example
what I am trying to achieve:
> t <- rnorm(100)
> cdf <- ecdf(t)
> cdf(0)
[1] 0.59
> saveRDS(cdf, "/tmp/foo")
>
Save workspace image? [y/n/c]: n
[gtrojan@asok petproject]$ R
> cdf <- readRDS("/tmp/foo")
> cdf
Empirical CDF
Cal
> Error in forecast[[d + 1]] = paste(index(lEJReturnsOffset[windowLength]), :
> object of type 'closure' is not subsettable
A 'closure' is a function and you cannot use '[' or '[[' to make a
subset of a function.
You used
forecast[d+1] <- ...
in one branch of the 'if' statement and
foreca
Thanks for all your help. This is helpful.
Best,
Bhaskar
On Sun, Feb 12, 2017 at 4:35 AM, Jim Lemon wrote:
> Hi Bhaskar,
> Maybe:
>
> df1 <-read.table(text="time v1 v2 v3
> 1 2 3 4
> 2 5 6 4
> 3 1 3 4
> 4 1 3 4
> 5 2 3 4
> 6 2 3 4",
> header=TRUE)
>
>
Thank you Rainer,
The question was :-
1. Identify those first names with different last names or more than
one last names.
2. Once identified (like Alex) then exclude them. This is because
not reliable record.
On Sun, Feb 12, 2017 at 11:17 AM, Rainer Schuermann
wrote:
> I may not be understand
I may not be understanding the question well enough but for me
df[ df[ , "first"] != "Alex", ]
seems to do the job:
first week last
Rainer
On Sonntag, 12. Februar 2017 19:04:19 CET Rolf Turner wrote:
>
> On 12/02/17 18:36, Bert Gunter wrote:
> > Basic stuff!
> >
> > Either subscripting
My understanding was that the discordant names has been identified. So
in the example the OP gave, removing rows with first = "Alex" is done
by:
df[df$first !="Alex",]
If that is not the case, as others have pointed out, various forms of
tapply() (by, ave, etc.) can be used. I agree that that is
By failing to send your email in plain text format on this mailing list, we see
a damaged version of what you saw when you sent it.
Also, we would need some some data to test the code with. Google "r
reproducible example" to find discussions of how to ask questions online.
From the error mess
Exactly. Sort of like the optimisation of using which.max instead of max
followed by which, though ideally the only intermediate vector would be the
logical vector that says keep or don't keep.
--
Sent from my phone. Please excuse my brevity.
On February 11, 2017 11:19:11 PM PST, P Tennant wro
Jeff, Rolf and Philip.
Thank you very much for your suggestion.
Jeff, you suggested if your data is big then consider data.table
My data is "big" it is more than 200M records and I will see if this
function works.
Thank you again.
On Sun, Feb 12, 2017 at 12:42 AM, Jeff Newmiller
wrote:
Hi.
I tried to run this R-code but still completely no idea why it still gives
error message: Error in forecast[[d + 1]] =
paste(index(lEJReturnsOffset[windowLength]), : object of type 'closure' is not
subsettable
Here is the R-code:
library(rugarch); library(sos);
library(forecast);library(la
Colleagues who use Word seem to find no problem with .wmf files.
On 11/02/2017 22:08, peter dalgaard wrote:
On 11 Feb 2017, at 20:13 , Jeff Newmiller wrote:
While the question AS POSED is off base here (and in fact unlikely to have any
satisfactory answer due to the unavoidable squishiness
Hi Bhaskar,
Maybe:
df1 <-read.table(text="time v1 v2 v3
1 2 3 4
2 5 6 4
3 1 3 4
4 1 3 4
5 2 3 4
6 2 3 4",
header=TRUE)
df2 <-read.table(text="time v11 v12 v13
3 112 3 4
4 112 3 4",
header=TRUE)
for(time1 in df1$time) {
time2<-which(df2$
Sorry for no reproducible example.
using warnings=FALSE chunk options in knitr does not help. I found it is not
the knitr's business. I used
resultpdf<-
grid.arrange(facetpoint1,pright1,pright2,pright3,pright4,pright5,pright6,pright7,
ncol=2, layout_matrix=cbind(c(1,1,1,1,1,1,1),c(2,3,4,
I am a user of package, "pls". I am going to draw the NIR spectra of my
own measured data using matplot.
Question
For example, I have such a csv data, "HyCa.csv", below.
Would you please tell me how to create a data like the "yarn".
yarn has the structure of "NIR" and "density".
That is
26 matches
Mail list logo