eate a reduced csv file called "mydata.csv"
write.csv(mydata[,grep('Location|Ambient|Name',names(mydata),invert=TRUE)],
file='mydata.csv')
should do what you want, but without a more concrete example, it's
just
Simona -
I don't think preallocating your random variables would make
the code run any faster.
A very simple change that would speed things up a little would
be to replace
simPD.vec[i]=length(R.vec[R.vec
Dear all,
Does anyone have any idea on how to speed up the for() loop below.
Current
axis labeled in what ever way you want, to
produce a whatever sort of plot you wanted. I'll leave it to you to
figure out the details.
- Phil Spector
Statistical Computing Facility
Jim -
I believe
dat[order(rownames(dat)),order(colnames(dat))]
is what you are looking for.
- Phil Spector
Statistical Computing Facility
Department of Statistics
111 19.57672 567 100.0
You can probably find the specific part you want from the above code.
- Phil Spector
Statistical Computing Facility
year')
xyplot(X~year|country*food,data=newdf)
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
Rohit-
If I understand you correctly, and your list's name is mylist,
then
mapply('*',mylist,as.numeric(names(mylist)))
will do what you want. In the future, please provide a reproducible
example.
1) adding an informative subject line
2) showing us what you tried without including
your typos and other errors.
I think you'll find this a more effective strategy than
trying to replace core elements of R that you don't
understand with empty functions.
to get it to print the way you listed, you need
to reduce the width of the line:
options(width=20)
use[use != '']
[1] "select sysdate "
[2] " from dual "
- Phil Spector
Andrew -
I believe
character.data$z = ifelse(is.na(character.data$x),
character.data$y,character.data$x)
should do what you want.
- Phil Spector
Statistical Computing Facility
t can rearrange the values.
Hope this helps.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Ber
not sure ifelse would be of much use here.
- Phil Spector
Statistical Computing Facility
Department of Statistics
=k;s=s;eval(parse(text=exprs[1]))}
expr1(3,2)
[1] 0.75
expr1(10,5)
[1] 0.5454545
- Phil Spector
Statistical Computing Facility
Department of Statistics
0.008 0.104
Of course, you could just do the calculation directly:
system.time({C1 = t(X) %*% X})
user system elapsed
0.008 0.000 0.007
all.equal(C,C1)
[1] TRUE
- Phil Spector
Stati
Giovanni -
If you change "int" (which has no meaning in R) to
"integer" in your second example, it should work.
- Phil Spector
Statistical Computing Facility
that
R can't handle large problems. Learning to use the apply family of functions
from the start avoids this misconception.
- Phil Spector
Statistical Computing Facility
tions.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
To get the equivalent of what your loop does, you could use
lapply(data[,3:5],function(x)x/ave(x,data$plateNo,FUN=mean))
but you might find the output of
sapply(data[,3:5],function(x)x/ave(x,data$plateNo,FUN=mean))
to be more useful.
- Phil Spector
.6. pts.7.9.
1 2011-01-01 2011-01-04 2011-01-07
2 2011-01-02 2011-01-05 2011-01-08
3 2011-01-03 2011-01-06 2011-01-09
sapply(z,class)
pts.1.3. pts.4.6. pts.7.9.
"Date" "Date" "Date"
- Phil Spector
')
rownames(ans) = NULL
ans
Date Ticker Return
1 20110301 MSFT 0.05
2 20110302 MSFT 0.01
3 20110301 GOOG -0.01
4 20110302 GOOG 0.04
- Phil Spector
Statistical Computing Facility
function(t)ifelse(t %in% c(1,2,3),1,0)
makez(3)
[1] 1
makez(4)
[1] 0
- Phil Spector
Statistical Computing Facility
Department of Statistics
e thorough or authoritive.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
Try
RN()
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
l 13.1 6.0
Gy1 12.6 7.9 6.2
Gy2 10.6 8.4 8.4 5.2
Green 10.6 9.4 9.9 6.5 4.1
Blue 10.8 10.2 10.3 8.8 7.0 6.4
BlP7.3 11.3 12.7 11.2 10.4 9.9 4.2
Pur1 5.4 11.5 12.9 11.7 10.8 9.4 8.4 4.5
Pur2 5.0 11.5 10.7 10.2 10.6 10.1 8.1 6.4 3.0
k.
I don't know what operating system you are using, but the
mdb tools are designed for non-Windows systems.
- Phil Spector
Statistical Computing Facility
atabase choice, and navigate to your
database. You should then be able to pass the Data Source Name you chose
to the odbcConnect function, and use the result in the odbcQuery to make
SQL queries to your data base.
Hope this helps.
))
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
On Sat, 26 Mar 2011, Bulent
Lisa -
Suppose your data frame is called "somedat". Then
do.call(rbind,spl[sapply(spl,function(z)z$result[1] == 0 & z$result[2] == 0 &
sum(z$result) == 1)])
should give you what you want.
You need to install the mysql client development libraries.
On SUSE systems, I believe the package is called
libmysqlclient-devel .
- Phil Spector
Statistical Computing Facility
Walter -
Since your codes represent numbers, you could use something like
this:
chk = as.numeric((hh.sub$HHFAMINC)
hh.sub$CS_FAMINC = cut(chk,c(-10,0,5,10,15,17,18),labels=c(0,1:5))
- Phil Spector
Statistical
tcltk support,
- Phil
On Fri, 8 Apr 2011, Rolf Turner wrote:
On 08/04/11 12:40, Erik Iverson wrote:
On 04/07/2011 07:32 PM, Rolf Turner wrote:
On 08/04/11 12:22, Erik Iverson wrote:
Rolf,
What does
capabilities("tcltk")
return?
match(list.a,list.b)
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
c(1,2,3,3)
allvals = rbind(lcd1,lcd2,lcd3)
pn = replicate(10,allvals[sample(smpool,1),])
but I can't be sure.
- Phil Spector
Statistical Computing Facility
?which
A <- c(1,2,3,4)
B <- c(0,3,1,5)
which(A
[1] 4
- Phil Spector
Statistical Computing Facility
Department of Statistics
apply(Next,1,function(x)answer[answer[,1]==x[1] & x[2] >= answer[,2] & x[2] <=
answer[,3],4])
[1] 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0
- Phil Spector
Statistical Computing Facilit
mtrx[outer(rownames(mtrx),colnames(mtrx),function(x,y)substr(x,2,4) ==
substr(y,2,4))]
Hope this helps.
- Phil Spector
Statistical Computing Facility
Department of Stati
bly do what you want.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@sta
7;
names(df)[wh] = paste(names(df)[wh],nm,sep='.')
df
}
Reduce(function(x,y)merge(x,y,by='id'),lapply(names(dfs),changenm))
- Phil Spector
Statistical Computing Facility
Abraham -
sudo apt-get install libxml2-dev
is what you need to get the development libraries and
xml2-config installed on your Ubuntu machine.
- Phil
On Mon, 25 Apr 2011, Abraham Mathew wrote:
Hello folks,
Here's is info on what syste
sudo apt-get install libcurl4-openssl-dev
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
Interestingly, for xml, it's last one listed.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berk
sudo apt-get install libsqlite3-dev
(Unfortunately, the method I described to find this package in my
previous post doesn't work for this one.)
- Phil Spector
Statistical Computing Fac
Hello All,
I am currently using the vennDiagram function in the limma pkg to
construct venn diagrams. I would like to change the size of the circles
based upon the n of each set (if that makes sense). Does anyone have any
ideas of how to do this?
Thanks,
Phil
[[alternative HTML
r 'rJava'
Can anyone help?
Thanks,
Phil
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.h
Hi All,
Is there anyway to combine vennDiagrams with venneuler commands so I can
have both of the diagrams as one? venneuler gives me proportionate circles
but without numbers and veenDiagrams gives me numbers without proportionate
circles.
Thanks,
Phil
[[alternative HTML version
Iain -
Do you see the same behaviour if you use
z <- unz(pathToZip, 'x.txt')
instead of
z <- unz(pathToZip, 'x.txt','r')
- Phil Spector
I wanted to round rather than truncate timestamps
# create a data set to work with
s <- 30 * rnorm(10, 1, 0.1)
gps.timestamp <- Sys.time() + s*1:10
gps.timestamp <- c(round(gps.timestamp[1], "min"), gps.timestamp,
as.POSIXct("2012-06-08 17:32:59"), as.POSIXct("2012-06-08 17:32:30"))
f <- funct
et 25 rows.)
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
Possibly overkill, I use a Windows batch file that calls a perl script.
Both the bat and pl files need to be in the executable path. Open a
command prompt, type `pwd ' and then drag the file or folder from the
Windows Explorer to the cmd. The script will return the file with
backslashes convert
Tim -
Another approach to your problem is to use xtabs:
xtabs(count~site+bug,data=myf)
bug
site grasshopper ladybug spider stinkbug
A 4 0 20
B 0 6 08
- Phil Spector
your data.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.be
e=TRUE)
should give you what you want.
- Phil Spector
Statistical Computing Facility
Department of Statistics
There's no need to use sapply or loops with grep -- it's
already vectorized. So you can find the rows you're
interested in with
wh = grep('^[.,]+$',df[,9])
store them with
sf = df[wh,]
and delete them with
df = df[-wh,]
ommon requirement, particularly among earth
scientists - perhaps they are all still using Matlab. Does anyone have
have a solution? Or maybe I am just not proficient enough at finding
solutions on the R-network...
Thanks in advance for your time,
Phil.
[[alternative HTML version de
thought was thorough) search.
Thanks in advance,
Phil.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-gu
I've found the keep,log=TRUE option of sas.get to be useful in cases like this.
There's also a log.file= option if you don't want the default location for the
log file.
- Phil Spector
Statistical Com
Dan -
Try using "having Premie not null" instead of
"having !is.na(Premie)" .
- Phil Spector
Statistical Computing Facility
Depa
sing=TRUE)[1:10],])
should give you what you want. In this simple case, you could
also use
do.call(rbind,by(df,df$z,function(dat)dat[order(dat$x,decreasing=TRUE)[1:10],]))
from base R to get the same result.
Hope this helps.
Try
sub <- subset(Claims, Year==Y1)
In R, the equality test is performed by two
equal signs, not one.
- Phil Spector
Statistical Computing Facility
Department
reproducible example goes a
long way towards getting a good answer.
- Phil Spector
Statistical Computing Facility
Department of Statistics
It sounds like the problem boils down to counting the number
of "_"s in the WELLID variable, and seeing if there are two:
nchar(gsub('[^_]','',edm$WELLID)) == 2
[1] FALSE FALSE TRUE TRUE TRUE TRUE FALSE
#x27;t reproduce the exact error which you saw.)
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
each of the different populations?
Thanks,
Phil.
--
Philip Rhoades
Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Fax: +61:(0)2-8221-9599
E-mail: [EMAIL PROTECTED]
__
R-help@r-project.org
Rolf,
On Wed, 2008-04-09 at 10:57 +1200, Rolf Turner wrote:
> On 9/04/2008, at 10:30 AM, Phil Rhoades wrote:
>
> > People,
> >
> > Say a particular measure of an attribute for individuals in different
> > populations gives a set of overlapping normal distribut
/windows/contrib/2.6
Warning message:
In open.connection(con, "r") : cannot open: HTTP status was '0 (nil)'
Can some one out there help interprt these for me? Is it an R problem, or is
it related to my server?
Regards,
Phil *
*
[[alternative
rlnorm takes two 'shaping' parameters: meanlog and sdlog.
meanlog would appear from the documentation to be the log of the mean.
eg if the desired mean is 1 then meanlog=0.
So to generate random values that fit a lognormal distribution I would
do this:
rlnorm(N , meanlog = log(mean) , sdlog
/repair processes which I
have read are typically log-normal. I should now be able to get the result i
expect to get.
Thanks again.
On Sun, May 4, 2008 at 3:11 PM, Berwin A Turlach <[EMAIL PROTECTED]>
wrote:
> G'day Phil,
>
> On Sun, 4 May 2008 14:05:09 +1000
> phil col
Another way to produce the data frame is
subset(as.data.frame(table(x)),Freq>0)
- Phil Spector
Statistical Computing Facility
Department of Statist
.352 0.012 0.363
If you look at the definitions of the functions, you'll see
that formatC is written in R, and sprintf uses a single call
to an .Internal function. I
- Phil Spector
$length
[1] 5
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
[EMAIL PROTECT
s:
1) In my data sheet I have the sites grouped together (i.e. above pollution,
below and unaffected), but the default setting in R seems to place these
alphabetically on the x-axis rather than in the order I have entered into
the spreadsheet. How to i correct this?
Many thanks,
Phil
method.hclust) :
NA/NaN/Inf in foreign function call (arg 11)
In addition: Warning message:
NAs introduced by coercion in: as.double.default(x)
Many thanks,
Phil
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https
You can use regular expressions:
as.Date(sub('(\\d+)m(\\d+)','\\1-\\2-01',dts,perl=TRUE))
but as.Date isn't as inflexible as you think:
as.Date(paste(dts,'m01',sep=''),'%Ym%mm%d')
- Phil Spect
Thank You Sarah! With your help, I was able to use the .Last function along
with
options (error = .Last)
to get what I wanted. So basically the new code that I need to add to my
process looks like:
.Last <- function()
{
cat("File Completed - WPS2R1 \n",file = "D:\\WPSWork\\WPS Temporar
Unless you issue the statement
library(gcl)
the gcl package will not be available in the current session.
Using demo does not load the package; only library() does.
- Phil Spector
Statistical Computing Facility
ething
improperly, or if there is a small bug somewhere.
I'm using windows Vista and R 2.8.1
Thanks,
Phil Taylor
ptay...@resalliance.org
> require(maptools)
> Sys.setenv(TZ = "GMT")
> location <- matrix(c(-80.1,42.5), nrow=1)
> sunriset(location, ISOdatet
Another possibility is Reduce:
Reduce(function(x,y,by='pos')merge(x,y,by='pos'),mylist)
pos data.x data.y data
1 A 2 69
2 B 6 23
3 C 3 96
4 D 1 72
5 E 9 51
sapply(l,length)
count1
[1] 4 6 52
Hope this helps.
- Phil Spector
Statistical Computing Facility
Department of Statistics
Monica -
Here's a more compact version of the same idea:
do.call(rbind,by(xveg,xveg['loc'],function(x)x[x$tot == max(x$tot),]))
- Phil Spector
Statistical Com
Richie -
There is a test= argument that can be set to "Chisq", "F" or
"Cp", for various different tests. See the help file for
anova.glm for details (or look at anova.xxx if your model is
of class "xxx").
The xlsReadWrite package provides write.xls for Windows,
while the dataframes2xls package provides write.xls for
non-Windows systems.
- Phil Spector
Statistical Computing Facility
k-gottshall/KScorrect.
We hope you find the functions useful when conducting goodness-of-fit
tests using the K-S test.
Sincerely,
Phil Novack-Gottshall and Steve Wang
--
~~~~~
Phil Novack-Gottshall
Associate Professor
Department of Biological S
ow do I do this?
Please reply to p...@cdc.gov
Thanks,
Phil Smith
p...@cdc.gov
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://ww
Hi R Community:
What is the R version of the S function fac.design()?
Please reply to: p...@cdc.gov
Thanks!
Phil Smith
CDC
Atlanta, GA
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman
Hi R-Help People!
I'm using the current version of R for Ubuntu: R version 4.2.1 (2022-06-23) --
"Funny-Looking Kid."
I'm using the quantmod package and am having difficulty with the getDividends()
function from the quantmod package.
Here is my code:
> library(quantmod)
>
> getDividends( "VO
ne:
Error in library(quantmod) : there is no package called ‘quantmod’
How do I install and load these packages successfully?
Thank you!
Phil Smith
Sent with [Proton Mail](https://proton.me/) secure email.
[[alternative HTML version deleted]]
__
R
On Wednesday, December 18th, 2024 at 11:00 AM, Bert Gunter
wrote:
>
>
> Please look at what you wrote.
> get.symbols vs. getSymbols.
>
> -- Bert
>
> On Wed, Dec 18, 2024 at 7:56 AM Phil Smith via R-help
> r-help@r-project.org wrote:
>
> > Hello r-
Hello r-project:
I want to load and use the tiny quant libary.
Hello R-project:
get.symbols doesn't work this morning.
I use this code:
#
#
# install.packages(c("quantmod", "TTR", "xts", "zoo" , "tidyquant" ))
# Load the tidyquant package
library("t
401 - 488 of 488 matches
Mail list logo