Many Thanks JS
karim
On Thu, Mar 5, 2015 at 4:08 AM, JS Huang wrote:
> Hi,
>
> Here is one for preserving the first strings. as.numeric in the previous
> posting is not necessary.
>
> > temp
> $set1
> [1] "a" "b" "d" "x"
>
> $set2
> [1] "b" "c" "q" "m"
>
> $set3
> [1] "b" "f" "e" "k" "q" "h"
Hi Mukesh,
Glad to see someone using BLCOP.
You didn't provide a reproducible example so I assume you got a result list
complete from optimalPortfolios.fPort() and wanted to obtain details of all the
10 simulations.
Short answer to your question: the function only renders the optimal value
wh
Hi,
Here is one for removing repeated strings.
> temp
$set1
[1] "a" "b" "d" "x"
$set2
[1] "b" "c" "q" "m"
$set3
[1] "b" "f" "e" "k" "q" "h"
> sapply(1:3,function(x){temp[[x]][as.numeric(table(unlist(temp))[temp[[x]]])==1]})
[[1]]
[1] "a" "d" "x"
[[2]]
[1] "c" "m"
[[3]]
[1] "f" "e" "k" "h"
Hi,
Here is one for preserving the first strings. as.numeric in the previous
posting is not necessary.
> temp
$set1
[1] "a" "b" "d" "x"
$set2
[1] "b" "c" "q" "m"
$set3
[1] "b" "f" "e" "k" "q" "h"
> sapply(1:length(temp),function(x){c <- list(); for (j in 1:x){c <-
> c(c,temp[[j]])}; temp[[x
Hi,
To avoid hardcoded 1:3, here is some revision.
> temp
$set1
[1] "a" "b" "d" "x"
$set2
[1] "b" "c" "q" "m"
$set3
[1] "b" "f" "e" "k" "q" "h"
> sapply(1:*length(temp)*,function(x){temp[[x]][as.numeric(table(unlist(temp))[temp[[x]]])==1]})
[[1]]
[1] "a" "d" "x"
[[2]]
[1] "c" "m"
[[3]]
[1]
What do you think dat$a is?
I recommend that you spend some time with an R tutorial if you plan to
use R. Your code is pretty bad. Examples: use of the ifelse
construction instead of if ... else; return()
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not i
Why do you have single quotes inside your single quotes?
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Li
I want to apply the following query to my database.
P2<-sqlQuery(ch1,'select *,
TimeStamp_Local,
ref_density,
ref_dewpoint,
ref_dir,
ref_precip,
ref_press,
ref_rh,
ref_snowfall,
ref_snowdepth,
ref_temperature_avg,
ref_temperature_m
Hello,
I am trying to use the following custom function in an aggregatefunction, but
cannot get R to recognize my data. I’ve read the help on function()and on
aggregate() but am unable to solve my problem. How can I get R torecognize the
data inputs for the custom function nested within aggrega
I would like to redraw a plot from the .SavedPlots object (list), using
R code (not arrows on the keyboard).
> windows(record=TRUE)
>
> x=runif(100)
> plot(x,col="blue")
> hist(x,col="red")
> plot(x,col="green")
> #When I try to replay any of the recorded plots (here, the second
one), I get th
> today <- as.Date("2015-03-04") # default format
Better is:
today <- Sys.Date()
S
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap
Sent: Thursday, 5 March 2015 7:47a
To: Brian Hamel
Cc: r-help@r-project.org
Subject: Re: [R] Using dates
The R Foundation is pleased to announce that our website
http://www.r-project.org/ has under gone a nice retouch (and
thus arrived in the 21st century :-)
Thanks to a working group of Dirk Eddelbuettel, Simon Urbanek and
Hadley Wickham.,
the current page sources are in markdown, and the html
Our R-user's group (UC Davis) has a good post on working with dates/times
in R:
http://www.noamross.net/blog/2014/2/10/using-times-and-dates-in-r---presentation-code.html
On Wed, Mar 4, 2015 at 11:08 AM, David L Carlson wrote:
> Wow! A bold prediction from someone who has done exactly zero
> i
Dear all,
I have set up a dedicated R server, which can be used by anyone with an
instant messaging application (Telegram).
See instructions at:
http://telemath.altervista.org/TeleR.html
It's still experimental, and not heavily tested. Any feedback or comment is
absolutely welcome.
Hope you li
I have a matrix plot of ternary diagrams (pdf attached) generated with
these commands:
opar <- par(xpd=NA,no.readonly=T)
plot(WintersY, pch=as.numeric(WintersX4),
col=c("black","red","green","blue","yellow","orange")[WintersX4])
legend(x=0.75, y=0.0, abbreviate(levels(WintersX4),
Hi all,
I want to compute the numerical values for modified second order bessel
function given x and other parameters, currently base R has a bessel
function for 1st order and I have tried to use the relationship between 1st
and 2nd order to compute the 2nd order bessel function, but I ended up
ge
Hi,
Sometimes, I need to do some hard work when exporting files using gdata
package.
It will be very useful if the justify parameter of write.fwf can receive
vectors. In some jobs I need to left and right justify in different columns
of the same file.
Nowadays, I do a lot ow this working in prep
Perhaps you should contact the package maintainer regarding this request.
Who is wise? One who learns from every person.
Who is strong? One who overpowers his evil inclinations.
Who is rich? One who is satisfied with his lot.
Who is honorable? One who honors his fellows.
- Pirkei Avot [excerpt]
Wow! A bold prediction from someone who has done exactly zero investigation of
the basic, built-in date/time features in R. Since your example did not include
the first two digits of the year, I've used %y instead of %Y. That will assume
"19" precedes values from 69-99 and "20" precedes values f
Tena koe Brian
See ?as.Date and ?strptime (and, maybe, ?locales). For example:
as.Date('2/15/15', '%m/%d/%y')
[1] "2015-02-15"
as.Date('12/15/14', '%m/%d/%y') < as.Date('2/15/15', '%m/%d/%y')
[1] TRUE
> as.Date('12/15/16', '%m/%d/%y') < as.Date('2/15/15', '%m/%d/%y')
[1] FALSE
You might have p
That worked great, thanks so much David!
On Wed, Mar 4, 2015 at 8:23 AM, David L Carlson wrote:
> I'm not sure I understand, but I think you have a large data frame with
> records and you want to construct a sample of that data frame that includes
> no more than 3 records for each IDbyYear combi
You will need to convert strings like "2/15/15" into one of the time/date
classes available in R and then it is easy to do comparisons. E.g., if you
have no interest in the time of day you can use the Date class:
> d <- as.Date(c("12/2/79", "4/15/15"), format="%m/%d/%y")
> today <- as.Date("2015-
Your hunch is wrong.
Start by typing
?Date
at the R prompt. Continue with
?as.Date
Then to find out if the date is earlier than today
delta <- thedate - Sys.Date()
(of course, that will change if you use it tomorrow)
Getting your indicator variable can be done very easily with base R; no
Since you indicated there are six more columns in the data.frame, getSample
modified below to take care of it.
> getSample
function(x)
{
sites <- unique(x$SiteID)
years <- unique(x$Year)
result <- data.frame()
x$ID <- seq(1,nrow(x))
for (i in 1:length(sites))
{
for (j in 1:length(y
Here is an implementation with function named getSample. Some modification to
the data was made so that it can be read as a table.
> fitting.set
IDbyYear SiteID Year
1 42.24 A-Airport 2006
2 42.24 A-Airport 2006
3 42.24 A-Airport 2006
4 42.
I try to use t.test instead of Wilcox.test in summary.formula() , a very
decent function developed by Frank, as follows. But I got error messages. Can
someone help me out?
Dick
uT<-function(a,b){
j<-t.test(a)
p<-list(P=j$p.value,stat=j$statistic,
df=j$parameter,
saikiran putta writes:
> I am new to R programming and trying to mine this pdf file
> http://164.100.180.82/Rollpdf/AC276/S24A276P001.pdf. This pdf file is in
> non-English language and I'm not able to figure out how to proceed. And,
> I'm not even sure how to extract information from a PDF file,
Hi all,
I have a dataset that includes a "date" variable. Each observation includes
a date in the form of 2/15/15, for example. I'm looking to create a new
indicator variable that is based on the date variable. So, for example, if
the date is earlier than today, I would need a "0" in the new colum
Hello all,
A straightforward question. How can I get a the values of the 90%
confidence intervals of a locpol in R? I can see how you can plot the
mean as well as the confidence intervals. I would like the matrix of
the values corresponding to the 95% and 5% exceedance probability.
An
Dear All,
here an example
temp <- list(set1=c("a","b","d","x"), set2=c("b","c","q","m"),
set3=c("b","f","e","k","q","h"))
preserve only the first one string
>temp
set1 a b d x
set2 c q m
set3 f e k h
OR
remove repeated string
>temp
set1 a d x
set2 c m
set3 f e k h
Thanks
[[alternativ
I'm not sure I understand, but I think you have a large data frame with records
and you want to construct a sample of that data frame that includes no more
than 3 records for each IDbyYear combination? You say there are 5589 unique
combinations and your code uses a data frame called fitting_set.
31 matches
Mail list logo