Hello,
I am going to estimate the parameter of the count model: pr(N=n)=
integration{B(x, alpha)-C(x,alpha)} by maximum likelihood estimation.
n<-c(0,1,2,3) and F<- (0,3,4,5) are the vectors of values and observed
frequency respectively. The function C(x,alpha) is not defined for n=0, but
s
Dear fellow R users,
I am trying to calculate the difference of the least square means from a
lmer model which has a pretty much standard form of Y ~ A*B + (1|C/D)
I am using the difflsmeans command from the lmerTest package but it
returns the following error line:
Error in as.data.frame.d
Kate — here is a transparent solution (tested but without NA treatment).
Doubtless there are cleverer faster ones, which later posters will present.
HTH
# example with four columns and 20 rows
nrows <- 20
A <- sample(c(1:100), nrows, replace=T)
B <- sample(c(1:100), nrows, replace=T)
C <- sampl
I have a problem with statistics, I think this forum is not the right
option, but I'm running out resolution to my problem, so I thought I expose
you here so someone could help me.
Realized a certain amount of tests in different groups, this assessment had
different weights, and the groups were for
Hi,
The following works.
> f2
function(z)
{
f1 <- function(t)
{
z*t + z*t^2
}
return(f1)
}
> sapply(1:5,function(x)integrate(f2(x),0,1)$value)
[1] 0.83 1.67 2.50 3.33 4.17
--
View this message in context:
http://r.789695.n4.nabble.com/inte
Hi all,
I’ve noticed that a script with unmatched brackets of any sort will fail
silently in Rscript—neither logging nor any output in the shell indicates
that anything went wrong. Example file to run in Rscript:
sink('/tmp/exampleoutfile')
a <- 0
{
print(a)
Replacing the ‘{‘ with any other sy
> On Feb 26, 2015, at 1:49 PM, marKo wrote:
>
> v1<-c(1:5)
> v2<-c(1:5)
>
> f1<-function (x) {v1*x+v2*x^2}
>
> The problem is that integrate(f1, 0, 1) does not work.
> I does not, even if a pas the arguments (v1, v2)
>
> f1<-function (x, v1, v2) {v1*x+v2*x^2}
>
> or if i try to vectorize the
> On Feb 26, 2015, at 2:02 PM, Scott Colwell wrote:
>
> I think I have one solution. Not very pretty though. Relies on the text not
> changing at all.
>
> as.numeric(gsub("Mean relative difference: ", "",
> all.equal(cov2cor(ITEMCOV),cor(item.data))[2]))
>
> Is there a better way?
>
`all.equ
marKo ffri.hr> writes:
>
> I'm a bit stuck.
> I have to integrate a series of polynomial functions with vector
> arguments.
>
> v1<-c(1:5)
> v2<-c(1:5)
>
> f1<-function (x) {v1*x+v2*x^2}
>
> The problem is that integrate(f1, 0, 1) does not work.
The point is not that there are "vector arguments"
Hello!
get_map help says:
location: an address, longitude/latitude pair (in that order), or
left/bottom/right/top bounding box
My code:
library(ggmap)
library(mapproj)
lat_bottom = 52.33 # bottom latitude of Berlin
lat_top= 52.5 # top latitude of Berlin
lon_left = 13.0 # left longit
Dear Mr Henningsen,
I have read the posting guide but apparently not well enough. I didn't find
how to include R code in my post. I'll read it again and I'll try to give a
clearer example.
Sorry for the inconvenience.
Kind regards,
Annelies
> Op 26-feb.-2015 om 21:59 heeft Arne Henningsen-3
I guess the answer to your question is "yes".
dta <- read.table( text=
"A B C D
0 1 0 7
0 2 0 7
0 3 0 7
0 4 0 7
0 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 1 5
0 5 1 5
0 4 1 5
0 8 4 7
0 0 3 0
0 0 3 4
0 0 3 4
0 0 0 5
0 2 0 6
0 0 4 0
0 0 4 0
0 0 4 0
", header=TRUE )
dtacmax <- sapply( dta, max )
followed b
> On 26 Feb 2015, at 20:20 , Duncan Murdoch wrote:
>
> On 26/02/2015 2:08 PM, Doran, Harold wrote:
>> Is there functionality within R proper, without having to revert to the OS,
>> allowing a function or a portion of an R script to be run at a defined time?
>> My google searches haven't provid
Dear Annelies
On 26 February 2015 at 09:12, hnlki wrote:
> I estimated a tobit model
> tobit.fit<-tobit(y~x,left=0, right=Inf) (library "AER")
> or
> tobit2.fit<-censReg(y~x, left=0, right=Inf) (library"censReg")
> I' have estimated the partial effect at the average as:
> pea<-(pnorm((colMeans(x
Hi,
Supposed I had a data frame like so:
A B C D
0 1 0 7
0 2 0 7
0 3 0 7
0 4 0 7
0 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 1 5
0 5 1 5
0 4 1 5
0 8 4 7
0 0 3 0
0 0 3 4
0 0 3 4
0 0 0 5
0 2 0 6
0 0 4 0
0 0 4 0
0 0 4 0
For each row, I want to count how many max column values appear to
adventurely get the
Everything Duncan said, plus:
A construction like this might do the job
run.at <- as.POSIXct('2015-02-26 13:05')
while(TRUE) {
if ( trunc(Sys.time(),'min') == run.at) source('whatever-it-is.r')
Sys.sleep(60)
}
but I wouldn't count on it to be as reliable as cron (or Windows
equivalent).
--
On 26/02/2015 2:08 PM, Doran, Harold wrote:
Is there functionality within R proper, without having to revert to the OS,
allowing a function or a portion of an R script to be run at a defined time? My
google searches haven't provided much other than one at the link below which
relies on an OS.
I think I have one solution. Not very pretty though. Relies on the text not
changing at all.
as.numeric(gsub("Mean relative difference: ", "",
all.equal(cov2cor(ITEMCOV),cor(item.data))[2]))
Is there a better way?
--
View this message in context:
http://r.789695.n4.nabble.com/Saving-Mean-Rela
Is there functionality within R proper, without having to revert to the OS,
allowing a function or a portion of an R script to be run at a defined time? My
google searches haven't provided much other than one at the link below which
relies on an OS.
Thanks,
Harold
https://tgmstat.wordpress.com
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I'm a bit stuck.
I have to integrate a series of polynomial functions with vector
arguments.
v1<-c(1:5)
v2<-c(1:5)
f1<-function (x) {v1*x+v2*x^2}
The problem is that integrate(f1, 0, 1) does not work.
I does not, even if a pas the arguments (v1, v2)
Hello,
Does anyone know how to save the numeric value of the "mean relative
difference" when using the all.equal() command?
For example this:
all.equal(cov2cor(ITEMCOV),cor(item.data))
Gives:
[1] "Attributes: < Length mismatch: comparison on first 1 components >"
[2] "Mean relative difference
Thanks everyone
--
View this message in context:
http://r.789695.n4.nabble.com/Extracting-Factor-Pattern-Matrix-Similar-to-Proc-Factor-tp4703704p4703904.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing lis
here is yet another way:
> dta <- read.csv( text=
+ "key_column,begin_date,end_date
+ 123456,2013-01-01,2014-01-01
+ 123456,2013-07-01,2014-07-01
+ 789102,2012-03-01,2014-03-01
+ 789102,2015-02-01,2016-02-01
+ 789102,2015-02-06,2016-02-06
+ 789102,2015-02-28,2015-03-31
+ 789102,2015-04-30,20
Look at "dirname()" and "basename()". The first would be what you call
the path. The second is the file.name without the path.
On Thu, Feb 26, 2015 at 10:58 AM, Luigi Marongiu
wrote:
> Dear all,
> what code should I write in order to extract the file name from a give
> path? Let's say that I want
Dig deeper.
-- Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll
On Thu, Feb 26, 2015 at 8:29 AM, Mikael Olai Milhøj
wrote:
> Hi.
>
> First of all, thx. But when
> On 26 Feb 2015, at 17:29 , Mikael Olai Milhøj wrote:
>
> Hi.
>
> First of all, thx. But when using in arima(...xreg=fact,...) then fact
> should be a vector and not a factor variable? Maybe I should have been more
> clear in my first mail, sorry. Or else I have to dig deeper into factors.
>
Dear all,
what code should I write in order to extract the file name from a give
path? Let's say that I want to get the file "my file.xls" which is in
the directory/folder "My documents"; since I work both with Windows
and Linux, the paths I am looking at are in the format:
path.windows<-"\\home$\
> Even though I was looking in several r-books
> I could not find a suitable function to this problem
Which R books did you look through?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Feb 26, 2015 at 4:02 AM, David Studer wrote:
> Hello everybody!
>
> I have a (probabely very easy) prob
Hi.
First of all, thx. But when using in arima(...xreg=fact,...) then fact
should be a vector and not a factor variable? Maybe I should have been more
clear in my first mail, sorry. Or else I have to dig deeper into factors.
/Mikael
On Thu, Feb 26, 2015 at 5:17 PM, Bert Gunter wrote:
> Inline
Inline.
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll
On Thu, Feb 26, 2015 at 8:02 AM, Mikael Olai Milhøj
wrote:
> Hi all
>
> I have been searching on
Dan,
FWIW, I have basically the system you describe, except a larger HD — I'm
quite happy, but I'm a biased Mac user, although I love my Ubuntu Linux
machine as well… One can bring any machine to its knees, so there is the
element of expectations. A MacBook Pro stacks up as well or better compared
Of course you could have created them as character vectors in the first
place:
dfx <- data.frame(
group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
sex = sample(c("M", "F"), size = 29, replace = TRUE),
age = runif(n = 29, min = 18, max = 54),
stringsAsFactors=FALSE
)
But if that is no
Hi all
I have been searching on the web in vain. I want to include a dummy
variable in my ARIMA model. Let's say that I want to make an AR(1) model
for X including a dummy variable which should be 1 for observation 4,5,6
and zero otherwise (let's say that there is 50 observations in total). How
do
For the record, the ave function in R can apply any function you specify, not
just mean. The primary feature of ave is that it does not collapse the rows
like aggregate does. Choose among them according to how you want the output to
be organized.
-
The following data.frame x as one column named Percent.
> x
Percent
1 10%
2 20%
3 30%
> as.numeric(substr(x$Percent,1,nchar(x$Percent)-1))
[1] 10 20 30
--
View this message in context:
http://r.789695.n4.nabble.com/covert-entire-dataset-to-numeric-while-persuing-percentage-values
I think you are getting ahead of yourself.
You use the term "dataset", which is colloquial and not precise. The read.csv
function returns a data.frame, in which each column can have its own storage
mode ("type"). Most data.frames do not have all columns of the same type... if
they were you migh
You store it as a list of lists and can then use the lapply function
to navigate for values.
result <- lapply(1:1, function(x){
mix(param[x]) # whatever your call to 'mix' is with some data
})
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me wha
Try as.character like the following shows.
> dfx <- data.frame(
+ group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
+ sex = sample(c("M", "F"), size = 29, replace = TRUE),
+ age = runif(n = 29, min = 18, max = 54))
> dfx
group sex age
1 A M 41.35554346
2 A F 47.7
Hello,
i need help, I'm trying to get oauth authorization to get rcredentials
.RData
the code that i use is:
>library(twitteR)
>library(tm)
>library(wordcloud)
>library(RColorBrewer)
>library(RCurl)
>library(ROAuth)
>options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem",
pac
On 26/02/2015 9:27 AM, Alaios via R-help wrote:
Dear all,in my code I am using the mix() function that returns results in a
list. The result looks like
List of 10
$ parameters :'data.frame': 2 obs. of 3 variables:
..$ pi : num [1:2] 0.77 0.23
..$ mu : num [1:2] -7034 162783
..
It would help a lot if you posted a subset of your data using 'dput'
so that we know what it actually looks like. You have character data
mixed with numerics, so you will be NAs in some cases.
Conversion of percent to numeric is accomplished with something like this:
> x <- c('12%', '6%', '3.75%
Here is another way. Have not tested for large scale efficiency, but if you
convert dta to a data.table that might improve things.
library(dplyr)
dta <- read.csv( text=
"key_column,begin_date,end_date
123456,2013-01-01,2014-01-01
123456,2013-07-01,2014-07-01
789102,2012-03-01,2014-03-01
789102,20
Dear all,in my code I am using the mix() function that returns results in a
list. The result looks like
List of 10
$ parameters :'data.frame': 2 obs. of 3 variables:
..$ pi : num [1:2] 0.77 0.23
..$ mu : num [1:2] -7034 162783
..$ sigma: num [1:2] 20235 95261
$ se :'data.f
Hi,
Some modification to work for both positive and negative number:
nchar(format(*abs*(a),scientific=FALSE))-(trunc(log10(max(1,trunc(abs(a)+1)
-1.
--
View this message in context:
http://r.789695.n4.nabble.com/How-many-digits-are-there-in-left-of-dot-of-0-0001-tp4703842p4703872.htm
It's possible to retrieve protein for swissport by protein name??
I try using seqinr and query but i didnt find a way to get all protein
that named Delta 9 acyl CoA desaturase.
If some one have an idea i be glad :P
thank you all
ᐧ
[[alternative HTML version deleted]]
Dear Xavier
See below for comments
On 26/02/2015 11:20, CHIRIBOGA Xavier wrote:
Dear colleagues,
For Tukey, I tried to load the function with
library(multcomp) but again a message says:
Error in library(multcomp) : any package called ‘multcomp’ has been found
I suspect you translat
Andrew's suggestion for Year is a help, but package nlmrt shows the
problem you are trying to solve is truly one where there is a Jacobian
singularity. (nlmrt produces the Jacobian singular values -- but read
the output carefully because these are placed for compact output as if
they correspond to
Dear David,
your email is quite confusing. Do you want to get the sum for each group
(A,B,C) or each variable as would be indicated by your result?
sum by group:
aggregate(data=testdata,var1~group,sum)
count by group:
aggregate(data=testdata,var1~group,length)
sum by variable:
sum(na.omit(test
On 25/02/2015 8:55 PM, ce wrote:
> Dear all,
>
> I would like to count how many digits are there on the left of a the dot of a
> numeric variable
>
> a=0.0001
This will depend on the formatting used. If default formatting used by
as.character() is fine, then
nchar(sub("^[[:digit:]]*[.]", "",
Hi David,
You have your answer in the question:
aggregate()
aggregate(cbind(var1,var2)~group, data=testdata, FUN=sum)
Although I am not sure what you intended to do with "testdata$x<-" as
the result cannot have the same number of rows than testdata
HTH,
Ivan
--
Ivan Calandra, ATER
Universi
Hello everybody!
I have a (probabely very easy) problem. Even though I was looking in
several r-books
I could not find a suitable function to this problem, that's why I hope
that someone here
could help me:
# Sample data:
group<-c("A","A","A","B","B","C","C","C")
var1<-c(1,0,0,1,1,0,NA,1)
var2<-c
yes this is exactly what I want and it works. thanks.
-Original Message-
From: "JS Huang" [js.hu...@protective.com]
Date: 02/26/2015 03:22 AM
To: r-help@r-project.org
Subject: Re: [R] How many digits are there in left of dot of 0.0001 ?
Hi,
To get the number of digits to the right of
Dear colleagues,
For Tukey, I tried to load the function with
library(multcomp) but again a message says:
Error in library(multcomp) : any package called ‘multcomp’ has been found
Thanks for ur help,
Xavier
__
R-help@r-project.org mailin
??glht would tell you that glht is a function from the multcomp package.
You need to load a package before you can use its functions.
library(multcomp)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Bio
Hi list
Can someone help me debug the following please:
Having downloaded and installed the bioconductor packages and Rgraphviz,
I am attempting to plot a network graph showing the relation among
chosen words in the corpus of text data.
I first did this:
> plot(dtm, terms=findFreqTerms(dtm,
Dear all ,
I am trying to do a Tukey comparison, but a message appears:
tuk<-glht(mod0,linfct=mcp(Soil="Tukey"));summary(tuk)
Error: could not find function "glht"
Anyone knows how to fix it?
Thanks a lot!
Xavier
__
R-help@r-project.org ma
Dear R-List,
#I have a df with the first two cols formatted as factor.
dfx <- data.frame(
group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
sex = sample(c("M", "F"), size = 29, replace = TRUE),
age = runif(n = 29, min = 18, max = 54))
# now I want to format both factor VARs as character
# I
Hi ,
I am little confused about how to covert entire dataset to numeric .
As I read data like..
Xelements =read.csv(file. Choose(),header = T, stringsAsFactors=FALSE)
str(xelements )
> str(xelements)
'data.frame': 731 obs. of 4 variables:
$ Engine.Speed : chr "rpm" "ES" "rpm" "1049" ...
$
Hi list
Closing this one off myself, this is what I did:
The error seems to concern the update of tm to version 0.6: the
conversion to lower case text should now be:
> docs <- tm_map(docs, content_transformer(tolower))
Everything else seems to work fine thereafter.
The issue in the tutorial
On 2015-02-26 00:33, JS Huang wrote:
Hi,
Here is an implementation. More data are added. An extra column hasRain
is added instead of replacing column Amount.
rain
Year Month Day Amount
1 1950 1 10.0
2 1950 1 2 35.5
3 1950 1 3 17.8
4 1950 1 4 24
> On 26 Feb 2015, at 06:26 , Dan Murphy wrote:
>
> Quick responses as usual. Can always count on R-Help! Bert's point
> that "it depends" is key, of course. Mark and Karim reminded me that R
> does not use all cores natively. Putting those together, an expensive
> quad core machine is not necess
Hi,
I estimated a tobit model
tobit.fit<-tobit(y~x,left=0, right=Inf) (library "AER")
or
tobit2.fit<-censReg(y~x, left=0, right=Inf) (library"censReg")
I' have estimated the partial effect at the average as:
pea<-(pnorm((colMeans(x)%*%tobit.fit$coef[-1])/tobit.fit$scale))%*%tobit.fitt$coef[-1]
a
Hi,
To get the number of digits to the right of decimal point:
nchar(format(a,scientific=FALSE))-(trunc(log10(max(1,trunc(abs(a)+1) -1.
The part (trunc(log10(max(1,trunc(abs(a)+1) is the number of digits to
the left of decimal. At the end, subtract 1 for the decimal point.
Nega
Hi,
It's not as easy as I originally thought. Here is a revision with the
function beginEnd to get it done.
> date
key_column begin_dateend_date
1 123456 2013-01-01 2014-01-01
2 123456 2013-07-01 2014-07-01
3 789102 2012-03-01 2014-03-01
4 789102 2015-02-01 2016-02-01
Hi,
I assume you want to know the digit count to the left of decimal point.
If this is the case, then you may use trunc(log10(max(1,trunc(abs(a)+1
for a numerical variable a. Count 0.12 as having one digit to the left of
decimal point.
> trunc(log10(max(1,trunc(abs(-10.99)+1
[1]
Hi,
Here is an implemenation:
> date
key_column begin_dateend_date
1 123456 2013-01-01 2014-01-01
2 123456 2013-07-01 2014-07-01
3 789102 2012-03-01 2014-03-01
4 789102 2015-02-01 2016-02-01
5 789102 2015-02-06 2016-02-06
> y <- t(sapply(unique(date$key_column),
66 matches
Mail list logo