Hello,
In
us_counties <- read.csv(text = x)
remove 'text=', you are reading from a url, not from a text string.
Hope this helps,
Rui Barradas
- Mensagem de Gayathri Nagarajan -
Data: Thu, 4 Mar 2021 21:51:05 -0800
De: Gayathri Nagarajan
Assunto: Re: [R] A tibble with da
Hello,Yes, I thought it's a site policy issue too. But the file can be accessed
and read/downloaded from RStudio and Firefox so apparently there's no reason
why R console shouldn't .Anyway, I believe it's time for the OP to say
someyhing, maybe he has solved it and there's no point in continuing
Hello,
Just don't include the names of those columns.
Is this what you want?
library(tidyr)
df_initial1 <- data.frame(col1name=c(1,2,3,4,5,6,7),
col2name=c(4,5,6,7,8,9,1), col3name=c(9,8,7,6,5,4,3))
df_initial2 <- data.frame(col1name=c(1,2,3,4,5,6,7),
col2name=c(4,5,6,7,8,9,1))
df_initial3
Hello,
Please don't post inHTML, the data is unreadable.
As for the question, it is very basic. try any of
plot(rate ~ year, data = df)# df is your dataframe
plot(df$year, df$rate)
Then read ?plot and ?par to see how to customize the graph, by
changing the plot type, how to add colors,
Hello,
Would the following do it?
agg <- aggregate(as.character(ID) ~ site2 + site1, daT1, paste, sep = ", ")
names(agg)[3] <- "ID"
agg
# site2 site1 ID
#1 2015-03-09 2015-03-03 A451
#2 2015-04-17 2015-03-03 A253
#3 2015-03-09 2015-03-30 CBA8
#4 20
Hello,
Maybe you want to take a look at function xtabs.
xtabs(~ site2 + site1, daT1)
Note that the results are different if you convert to class "Date" first.
daT1$site1 <- as.Date(daT1$site1, format = "%d-%b-%Y")
daT1$site2 <- as.Date(daT1$site2, format = "%d-%b-%Y")
xtabs(~ site2 + site1, da
Hello,
Sorry for the HTML, I hadn't realised that my cellphone was not
sending in plain text.
Rui Barradas
Citando ruipbarradas :
Hello,Maybe I'm not understanding but to compute the sample variance
you need at least 2 data points? The ML estimator can be computed
with
Hello,Maybe I'm not understanding but to compute the sample variance you need
at least 2 data points? The ML estimator can be computed with just 1 but it
will be zero.Hope this helps,Rui Barradas Enviado a partir do meu smartphone
Samsung Galaxy. Mensagem original De: Thomas Subi
Hello,
That is not a row, what you seem to have is an object of class
"matrix" and when it's printed it prints the column names or [,1]
[,2] etc if there aren't any colnames. So your matrix has just one
column and 4 rows with rownames 'date', 'Peeps', 'days', 'worn'.
Hope this helps,
R
Hello,
Instead of nrow try all uppercase:
N <- NROW (ts)
Hope this helps,
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original
De: Subhamitra Patra Data: 06/10/2018
10:14 (GMT+00:00) Para: drjimle...@gmail.com Cc: r-help@r-project.org Assunto:
Bonjour,
Vous êtes en erreur, cette liste est la liste R-Help pour aider ceux qui ont
des doutes sur le langage de programmation R, un langage pour statistique,
analyse de donnés et graphiques scientifiques.
Cordialement,
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. M
Hello,
25*30
This is the most basic possible, please google an intro text and run its
examples.
Hope this helps,
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original
De: Nathan D Jennings Data: 05/09/2018
00:30 (GMT+00:00) Para: r-help@r-projec
Hello,
Also possible is
is.na (B) <- B >= A
Hope this helps,
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original
De: Bert Gunter Data: 23/06/2018 15:26
(GMT+00:00) Para: javad bayat Cc: R-help
Assunto: Re: [R] Deleting a specific value in a
Hello,
Instead of Reduce try do.call.
do.call ('rbind', list)
But with such a long list it will still take time.
Hope this helps,
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original
De: Christofer Bogaso Data: 10/06/2018
16:33 (GMT+00:00) Para:
Hello,
I had a similar problem a while ago.And it was also a problem with
AVG.Apparently these false positives are a known issue with that AV. At the
time I got an answer directing me to an online source on this but it was some
3-4 years ago and I don't believe I still have it.
Anyway, the probl
Hello,
Right. Missed that one.
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original
De: Eric Berger Data: 30/01/2018 10:12
(GMT+00:00) Para: Rui Barradas Cc: Daniel Nordlund
, smart hendsome ,
r-help@r-project.org Assunto: Re: [R] Simulation ba
Because you need to separate the instructions with a ; (semi-colon).
Hope this helps
Rui Barradas
Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original
De: Ek Esawi Data: 08/01/2018 16:03 (GMT+00:00)
Para: Jeff Newmiller , r-help@r-project.org Assunto:
Re: [R]
Hello,
Also, the other file, NPA.csv, is not in tabular form. Can you please
reformat it?
Rui Barradas
Citando ruipbarra...@sapo.pt:
Hello,
Please keep this on the list, always cc r-help.
One of the files in your attachment is empty:
y <- read.csv(file.choose("GT.csv"))
Error in read.tab
Hello,
Please keep this on the list, always cc r-help.
One of the files in your attachment is empty:
y <- read.csv(file.choose("GT.csv"))
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
no lines available in input
Rui Barradas
Citando Chaitanya Ganne :
> Than
Hello,
Just count:
city is 3*5 == 15,
population is length(4000:6000) + length(3500:4300) + length(3000:3200)
== 2001 + 801 + 201 == 3003
Hope this helps,
Rui Barradas
Citando Shivi Bhatia :
Hi Team,
I using the syntax as:
data.df<- data.frame(
city= c(rep(c("Delhi",
Hello,
I believe that the easiest way is
curve(1/x, -5, 5)
Also, you're missing a '-' in y < 1/x, it should be y <- 1/x
Hope this helps,
Rui Barradas
Citando AbouEl-Makarim Aboueissa :
Dear All: good morning
I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
I am
Hello,
Post the two equations, a sample dataset and what you have tried, please.
At the bottom of every mail there's a link to the posting guide where
you will find instructions on how to ask a good question.
Hope this helps,
Rui Barradas
Citando Jessie Todd :
I don’t know if my question
Hello,
What makes you think that there is a file named "datahs0csv.rda"? You
have not saved the file, in fact you have done nothing at all.
If you want to create a file "datahs0csv.rda", use ?save.
(And don't use 'attach', please.)
Hope this helps,
Rui Barradas
Citando AbouEl-Makarim Aboue
Hello,
One way of preventing that is to use ?force.
Just put
force(l)
right after the commented out print and before you change 'u'.
Hope this helps,
Rui Barradas
Citando Matthias Gondan :
Dear R developers,
sessionInfo() below
Please have a look at the following two versions of the
Hello,
The best way for you to know that is to read the package's documentation.
https://cran.r-project.org/web/packages/phytools/index.html
I suggest the refference manual phytools.pdf
Hope this helps,
Rui Barradas
Citando Tauras Vilgalys :
Hi, I'm interested in using pbtree (package ph
Hello,
I'm not at all sure if the following is what you need but instead of
for (i in length(FD$WEEK))
try
for (i in 1:length(FD$WEEK))
or even better
for (i in seq_len(FD$WEEK))
And use Control[i, 1], not Control[, 1]
Hope thi helps,
Rui Barradas
Citando Christoph Puschmann :
Hey
Hello,
Use package quantreg, function rq().
install.packages("quantreg")
?rq
Hope this helps,
Rui Barradas
Citando Bryan Mac :
Hi R-help,
How do you perform least median square regression in R? Here is what
I have but received no output.
LMSRegression <- function(df, indices){
sampl
Hello,
Your attachment didn't come through, save the file in the csv format
and name it *.txt.
Moreover, you ask what is wrong with your syntax, but what syntax?
What is your code? Post a minimal example of what you are trying if
you want answers from us.
In the mean time at an R pormpt tr
Hello,
I've just ran your code and it all went well.
So my doubt is: if you have 1269 rows why choose only 100 and
bootstrap? It doesn't seem to make much sense to me.
Try to run the entire df through DataSummary and compare the results
with the bootstrap results.
Rui Barradas
Citando Bry
Right.
To see it in action just compare the results of the two calls to boot.
library(boot)
set.seed(1007)
x <- rnorm(100)
y <- x + rnorm(100)
dat <- data.frame(x, y)
#Wrong
stat1 <- function(DF, f){
model <- lm(DF$y ~ DF$x, data = DF[f,]) #Doesn't bootstrap DF
coef(model)
}
Sorry, but what formula? formula is not a ?boot argument.
To the OP: Michael is probably right, if you reset the seed each time,
you'll get equal values, otherwise you should get different results
due to randomization.
Rui Barradas
Quoting Christoph Puschmann :
Dear Bryan,
Did you try t
Hello,
Read the help page ?boot::boot.
For instance, try the following.
library(boot)
x <- rnorm(100)
stat <- function(x, f) mean(x[f])
boot(x, stat, R = 100)
Hope this helps,
Rui Barradas
Citando bryan.mac24 :
Hi all,
I am wondering how to conduct bootstrapping in R. I need bootstrap
Hello,
No one mentioned that read.csv2 and read.csv are particular cases of
read.table.
read.table(text = "
var1;var2;var3
TI;1995;4.5
VD;1990;4.8
FR;1994;3.9
VS;1993;5.1
FR;1995;4.7
FR;1992;5.8
", header = TRUE, sep = ";", dec = ".") -> don
str(don)
Rui Barradas
Citando Nordlund, Dan (D
Hello,
If you work with a matrix instead of a data.frame, it usually runs
faster, but your column vectors must all be numeric.
### Fast, but not fast enough
system.time(replicate(500, tmp[which(tmp$id == idList[1]),]))
user system elapsed
0.050.000.04
### Not fast at all, a
Hello,
Is this what you mean?
dat <- data.frame(x = rnorm(100), A = factor(sample(3, 100, TRUE)), B
= factor(sample(3, 100, TRUE)))
xtabs(~ A + B, dat)
Hope this helps,
Rui Barradas
Citando Andrea Marcela Huerfano Barbosa :
Hi everyone,
My name is Marcela, I am bachelor student of stat
Hello,
data["601",] doesn't generate an error because you can also refer to a
row by its name, as an alternative to refering to it by row number.
It's the same with vectors, just consider the following case.
(x <- c("601"=1, b=2))
x[1]
x["601"] # the same
But when you want to remove it yo
Hello,
The error message means exactly what it says. The operator '-' is
unary and cannot be followed by a non-numeric atomic object (a vector).
Try for instance
x <- list(a=1:10, b=rnorm(5))
-x
Rui Barradas
Citando Pauline Laïlle :
> Works like a charm, thanks! Still don't know what that
Sorry, I've made a stupid mistake.
It's obviously the other way around.
ix <- which(rownames(data) %in% c("601", "604"))
clean <- data[-ix, ]
Rui Barradas
Citando ruipbarra...@sapo.pt:
Hello,
Try something like the following.
ix <- which(c("601", "604") %in% rownames(data))
clean <- data[
Hello,
Try something like the following.
ix <- which(c("601", "604") %in% rownames(data))
clean <- data[-ix, ]
Hope this helps,
Rui Barradas
Citando Pauline Laïlle :
Dear all,
I built a dataframe with read.csv2(). Initially, row names are integers
(order of answers to a survey). They a
Hello,
What about the following?
ff <- dimInfo[grep('HS', dimInfo)]
sub("^.*HS_([[:alnum:]]).*$", "\\1", ff)
Hope this helps,
Rui Barradas
Citando Doran, Harold :
I have produced a terribly inefficient piece of codes. In the end,
it gives exactly what I need, but clumsily steps through m
Hello,
Maybe you should ask the maintainer of both packages.
maintainer("plyr")
[1] "Hadley Wickham "
maintainer("dplyr")
[1] "Hadley Wickham "
Hope this helps,
Rui Barradas
Citando Christopher W Ryan :
I've set myself the task of learning about these packages, and about
tidy data con
Hello,
I failing to understand the problem, isn't the following what you want?
(test2 <- gsub("\\", "/", test, fixed = TRUE))
[1] "8/24/2016" "8/24/2016" "6/16/2016" "6/16/2016"
Hope this helps,
Rui Barradas
Citando Joe Ceradini :
Hi all,
There are many R help posts out there dealing with
Actually, there was another reason for the function equal() but I
wasn't remembering what.
all.equal doesn't recycle its arguments, just see this example.
equal <- function(x, y, eps = .Machine$double.eps^0.5) abs(x - y) < eps
x <- seq(0, 1, by = 0.2)
x == 0.6
all.equal(x, 0.6)
equal(x, 0.6)
Not exactly, all.equal is much more complete.
It accepts all kinds of objects, not just vectors.
Rui Barradas
Citando Ivan Calandra :
Hi,
Not sure, but it seems that your function equal() is exactly what
all.equal() does, isn't it?
Ivan
--
Ivan Calandra, PhD
Scientific Mediator
Univers
Hello,
See FAQ 7.31.
It's irrelevant if you write 100 or 100.0, the values are the same.
The difference would be between 100 (double) and 100L (integer).
To check for equality between floating-point numbers you can use, for
instance, the following function.
equal <- function(x, y, eps = .Ma
Hello,
Try placing the & immediately after the substr() conditions, like this:
base <- baseR[substr(baseR[['ID']],3,4)!='03' &
substr(baseR[['ID']],11,12)!='01' &
substr(baseR[['ID']],11,12)!='11',]
Maybe I'm wrong but R might have decided that
Hello,
Try ?aggregate, it's probably faster.
With a made up data.frame, since you haven't provided us with a dataset,
simout.s1 <- data.frame(SID = rep(LETTERS[1:2], 10),
DOSENO = rep(letters[1:4], each = 5),
value = rnorm(20))
res2 <- aggregate(simout.s1$value,
Hello,
Try
attach(get(yyz))
Hope this helps,
Rui Barradas
Citando Juan Ceccarelli Arias :
Hi.
I need to loop over rda files.
I generated the list of them.
That's ok. The problem is that the name of the files are as _mm (eg
2010_01 is january or 2010, 2016_03 is march of 2016).
So,
So you should do
table(region[sex=="Hombre"],type[sex=="Hombre"]
Rui Barradas
Citando Juan Ceccarelli Arias :
str(sex)
Factor w/ 2 levels "Hombre","Mujer": 1 2 2 1 2 2 1 1 1 1 ...
On Thu, Aug 25, 2016 at 1:42 PM, wrote:
_Maybe sex is a factor and Man its label. Factors are coded
inte
Maybe sex is a factor and Man its label. Factors are coded internally
as integers, to see it use
str(sex)
Rui Barradas
Citando Juan Ceccarelli Arias :
> Nop. I didn't work. But using the following it does work.
> table(region[sex=="Men"],type[sex=="Men"])
> When i use the dta file with stat
Hello,
Try instead
table(region[sex==1],type[sex==1])
To test for equality use == not =.
Hope this helps,
Rui Barradas
Citando Juan Ceccarelli Arias :
> Hi
> Im a bit lost.
> Ive imported a stata13 file. When i try to make a simple
> table(region[sex=1],type[sex=1])
> i get something as
>
Maybe it's better to open a new thread.
Rui Barradas
Citando Juan Ceccarelli Arias :
> The error wasn't in the loop. It was in the file list.
> It's running now because i added full.names option to TRUE
> fuente=list.files("C:/Users/Jceccarelli/Bases/Stata",
> pattern="dta$", full.names=T)
>
Hello,
That means that probably the files are in a different folder/directory.
Use getwd() to see what is your current directory and
setwd("path/to/files") to set the right place where the files can be found.
Rui Barradas
Citando Juan Ceccarelli Arias :
> I just doesn't work...
> Im loading t
Or maybe a print() statement on the table() in the loop.
print(table(...))
Rui Barradas
Citando David Winsemius :
>> On Aug 23, 2016, at 10:01 AM, Juan Ceccarelli Arias
>> wrote:
>>
>> Im running this but the code doesn't seem work.
>> It just hangs out but doesn't show any error.
>>
>> fo
Hello,
Where does read_dta come from? You should also post the library() instruction.
Try to run the code without the loop, with just one file and inspect
xxx to see what's happening.
xxx <- read_dta(fuente[1])
str(xxx)
table(xxx$cise, xxx$sexo)
Rui Barradas
Citando Juan Ceccarelli Arias :
Hello,
The op could also use package sos to find that and other packages to
read stata files.
install.packages("sos")
library(sos)
findFn("stata")
found 374 matches; retrieving 19 pages
2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19
Downloaded 258 links in 121 packages
The first package is re
Hello,
That argument doesn't exist, hence the error.
Read the help page ?read.dta more carefully. You will see that already
read.dta reads into a data.frame.
Hope this helps,
Rui Barradas
Citando Juan Ceccarelli Arias :
> Hi
> I need to apply some code over some stata files that are in fol
Hello,
Have you tried ?write.table?
write.csv is a wrapper for write.table with the appropriate settings
such as sep = ",", etc.
From the help page for write.csv:
"These wrappers are deliberately inflexible: they are designed to
ensure that the correct conventions are used to write a valid
Hello,
As for base 58 or base 62 I don't know, but for base 16 see
?as.hexmode. See also ?strtoi.
Hope this helps,
Rui Barradas
Citando Ferri Leberl :
> Dear everyone,
> Is there an R-command to change the expression of a number into
> hexadecimal, base58 base62 or any other common encod
Hello,
You're missing a double quotes. Right after format=
Hope this helps,
Rui Barradas
Citando Loris Bennett :
> Hi,
>
> When I try
>
> d <- as.difftime("6-08:18:33",format=%d-%H:%M:%S")
>
> I get:
>
> Error: unexpected SPECIAL in "as.difftime("6-08:18:33",format=%d-%"
>
> Am I correct in
Hello,
Your ifelse will never work because
reasons$salutation== "Mr" & reasons$salutation=="Father" is always FALSE
and so is reasons$salutation=="Mrs" & reasons$salutation=="Miss".
Try instead | (or), not & (and).
Hope this helps,
Rui Barradas
Citando Shivi Bhatia :
> Dear Team,
>
> I need
Hello,
Please use ?dput to post a data example. Use something like the
following, where 'dat' is the name of your data.frame.
dput(head(dat, 30)) # paste the output of this in a mail
Hope this helps,
Rui Barradas
Citando Вова Грабарник :
> Dear R command,
>
> I was wondering if I could a
Hello,
I don't have a solution but see the difference between the two loops below.
for(j in 1:2)
for(i in 1:2){
cat(y[i,j], "\n")
cat(x[i,j][[1]], "\n")
cat(y[i,j] %in% x[i,j], "\n", "\n")
}
for(j in 1:2)
for(i in 1:2){
cat(y[i,j], "\n")
cat(x[
Hello,
Just use ?sub.
x <- "35.84375_.100.71875"
y <- sub("_\\.", "_-", x)
Hope this helps,
Rui Barradas
Citando lily li :
> Thanks, but how to get the string like this:
> "35.84375_-100.71875" use the minus sign instead of dot.
>
> On Thu, Jul 28, 2016 at 2:38 PM, jim holtman wrote:
>> ju
Hello,
Try
chars = c('A','B','C','D')
matrix1 = matrix(nrow = length(1:100), ncol = length(1:5)*length(chars))
k = 0
for(i in 1:length(1:5)){ # or more simply just for(i in 1:5)
for(j in 1:length(chars)){
k = k+1
matrix1[,k] = k
}
}
matrix1
tmp <- expand.grid(chars, 1:5, stringsAsFac
Hello,
Another thing to consider is to use Variable1 = NA, not '=='.
With '==' it will probably return TRUE/FALSE/NA.
Hope this helps,
Rui Barradas
Citando Ivan Calandra :
> This might not be the whole story, but part of the problem is that
> you want to select a _*character string*_ great
No, it means precisely the opposite.
Google "confidence interval", please.
Rui Barradas
Citando Tom Subia :
> Default level = 0.95.
> Does this mean +/- 0.025 from estimate?
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.o
Hello,
Maybe something like the following (untested).
idx <- Matched %in% df2$Serial
MatchedCount <- df2$Count[idx]
Hope this helps,
Rui Barradas
Citando ch.elahe via R-help :
> Hi all,
> I have 2 data frames like the following:
> the first one df1:
>
> 'data.frame': 141obs. of 1 varia
Hello,
I'm glad that it helped.
Note, however, that you don't need inter.m <- as.matrix(...) because
inter$x already is a matrix.
You can simply do
inter.row <- nrow(inter$x)
answer <- inter$x[inter.row,1]
Rui Barradas
Citando Narendra Modi :
> Thanks! that worked.
>
> I also tested with t
Hello,
Try
dimnames(inter$x)[[1]]
You could have seen this by inspecting 'inter':
str(inter)
Hope this helps,
Rui Barradas
Citando Narendra Modi :
> I am able to perform regression on a dataset as below:
>
> plot(x,y)
> lin.mod <- lm(y~x)
> m <- mean(x)
> m
>
> segmented.mod <- segmented(
Hello,
Maybe something like this.
fls <- list.files(pattern = "*.csv")
dat.list <- lapply(fls, read.csv)
dat <- do.call(rbind, dat.list)
Hope this helps,
Rui Barradas
Citando lily li :
> Hi R users,
>
> I'd like to ask that how to merge several datasets into one in R? I put
> these csv file
Hello,
You could do
ds_test[is.na(ds_test$var1), ] <- 0 # note the comma
or, more generally,
ds_test[] <- lapply(ds_test, function(x) {x[is.na(x)] <- 0; x})
Hope this helps,
Rui Barradas
Citando g.maub...@weinwolf.de:
> Hi All,
>
> I would like to recode my NAs to 0. Using a single vecto
Hello,
Try the following.
dat <- read.csv(text = "
Regime, Industry, Cost
10, 01, 370
11, 01, 400
10, 02, 200
10, 01, 500
11, 02, 60
10, 02, 30
")
dat
res <- aggregate(Cost ~ Industry + Regime, data = dat, sum)
res <- res[order(res$Industry), ]
res
And see the help page ?aggregate
Hope this
Hello,
Sorry, forget my first answer, I misunderstood what you wanted.
Let's try again.
First of all you have a typo in your second sample2, you wrote 'sample
2' with a space.
Now try this.
fun2 <- function(n){
merge(lst[[n]], lst[[n + 1]])
}
N <- which(seq_along(lst) %% 2 == 1)
lst2 <- l
Hello,
Maybe something like the following.
lst <-
list(data.frame(name="sample1", red=20), data.frame(name="sample1",
green=15), data.frame(name="sample2", red=10), data.frame(name="sample
2", green=30))
fun <- function(DF){
data.frame(name = DF[, 1], color = colnames(DF)[2], colnum = DF
Hello,
Don't use subset, use indexing.
subdf <- df[df$quant %in% "VeryFast", ]
By the way, instead of %in% you can use ==, since you're interested in
just one value of quant.
Hope this helps,
Rui Barradas
Citando ch.elahe via R-help :
> Hi all,
> I have the following df and I want to know
Hello,
Maybe the following (untested).
table(df$Protocol[df$Speed == "SLOW"])
Hope this helps,
Rui Barradas
Citando ch.elahe via R-help :
> Hi all,
> I have the following df:
>
> $ Protocol : Factor w/ 48 levels "DP FS QTSE SAG",..: 2 3
> 43 42 31 36 37 30 28 5 ...
>
> $ Speed
Hello,
First of all, it's better to post data using ?dput. Below, I give an
example of that in the lines structure(...).
dat <-
structure(list(rs = c(" rs941873 ", " rs634552 ", " rs11107175 ",
" rs12307687 ", " rs3917155 ", " rs1600640 ", " rs2871865 ",
" rs2955250 ", "
Hello,
See the help page for ?lower.tri.
If your matrix is named 'x', something like
x[upper.tri(x)]
Hope this helps,
Rui Barradas
Citando Denis Francisci :
> Hi all,
> I've a simple question.
> I have a matrix with same values over and under the diagonal. That's an
> example:
> [,1] [,2]
Hello,
Works with me, but I'm using R v 3.3.0. Note that your version of R is
over 1 year old, try updating it.
install.packages("caret")
install.packages("e1071")
library(caret)
library(e1071)
set.seed(100)
tr.control <- trainControl(method="cv", number=10)
class(tr.control)
[1] "list"
Ho
Hello,
I'm cc'ing R-Help.
Sorry but your question was asked 3.5 years ago, I really don't
remember it. Can you please post a question to R-Help, with a
reproducible example that describes your problem?
Rui Barradas
Citando catalin roibu :
> Dear Rui,
>
> I helped me some time ago with
Hello,
You're right, sorry, I missed the parenthesis:
colordata$response <- (colordata$color == 'blue') + 0
Rui Barradas
Quoting Michael Artz :
> Fyi, This statement returned the following error
> 'Error in "Yes" + 0 : non-numeric argument to binary operator'
>
>
> On Thu, Apr 7, 2
Hello,
Or even simpler, without ifelse,
colordata$response <- colordata$color == 'blue' + 0
Hope this helps,
Rui Barradas
Citando David Barron :
> ifelse is vectorised, so just use that without the loop.
>
> colordata$response <- ifelse(colordata$color == 'blue', 1, 0)
>
> David
>
> On 7 Ap
Sorry, but in your original post you said that " Null Hypothesis (H0)
is that the error produces by model A is not lower than model B".
If now is that model A produces less error change to
alternative="less". The relevant part in the help page ?t.test is
alternative = "greater" is the alternat
Hello,
Try
?t.test
t.test(mA, mB, alternative = "greater")
Hope this helps,
Rui Barradas
Citando Eliza Botto :
> Dear All,
> I want to test a hypothesis in R by using student' t-test (P-values).
> The hypothesis is that model A produces lesser error than model B at
> ten stations. Obvious
Hello,
Use combined ifelses, more or less like the following.
ifelse(dat[, 2] == Inf, do this, ifelse(dat[, 2] > 0, 1 * (1/dat[,3]),
-1* (1/dat[,3])))
Rui Barradas
Citando Stephen HK WONG :
> So much thanks Rui, the code can be so simple and fast.
>
> By the way, ifelse is good for two con
Hello,
I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try
dat[, 4] <- ifelse(dat[, 2] > 0, 1 * (1/dat[,3]), -1* (1/dat[,3]))
Oh, and why do you multiply by 1 and by -1?
It would simply be 1/dat[,3] and -1/dat[,3].
Hope this helps,
Rui Barradas
Quoting Stephen HK WONG :
Hello,
Apparently your v_neighbours is a named vector of integers, so
v_neighbours[1:3]
or just
v_neighbours
will do the job(!)
Hope this helps,
Rui Barradas
Quoting "Ragia ." :
Dear group
I have the following variable v_neighbours and it holds a vector
of the following :
gawke
Hello,
rep() is vectorized so you can do
rep (my_list, 2:3)
Hope this helps,
Rui Barradas
Citando André Luis Neves :
> Dear,
>
> I have the following data:
>
> v1 <- c(8,4,9,12)
> v2 <- c(7, 8, 11)
> my_list <- list(v1,v2)
> rep (my_list,3)
>
> My question is how I can modify my command lin
Hello,
What you want is a list of lists.
Try something like
Parameters <- list(PC_h_m = list(descript = "Point de convergence
hauteur en metre", value = 5),
PC_Q_m3 = list(descript = "Point de convergence debit en
m3/s", value = 805.00))
Hope this helps,
Rui Barradas
Citando MAUR
Hello,
You can't use tab$MVAR but you can use tab[[MVAR]] if you do MVAR <-
"population" (no need for c()).
Hope this helps,
Rui Barradas
Citando Amoy Yang via R-help :
> population is the field-name in data-file (say, tab).
> MVAR<-population takes data (in the column of population) rat
Sorry, there's a mistake, there's a missing comma, it should be
df[df$date >= '2012-01-01'& df$date <= '2013-12-31', ]$A
Rui Barradas
Citando ruipbarra...@sapo.pt:
> Hello,
>
> Try
>
> df[df$date >= '2012-01-01'& df$date <= '2013-12-31']$A = etc
>
> Hope this helps,
>
> Rui Barradas
>
>
> C
Hello,
Try
df[df$date >= '2012-01-01'& df$date <= '2013-12-31']$A = etc
Hope this helps,
Rui Barradas
Citando lily li :
> Hi R users,
>
> I have a data frame, and I generate a date column like this:
> df$date = seq(as.Date('2012-01-01'), as.Date('2014-12-31'))
>
> df
> A B C
> 1 2 1
>
Hello,
Try
x[grepl("Yes", x) & x != ""]
Hope this helps,
Rui Barradas
Citando carol white via R-help :
> Hi, it might be trivial but is there any way to get the logical
> vector of the indices of a string in a vector? I thought that %in%
> would do but it doesn't. I also want to filter
Hello,
Maybe something like the following.
temp2 <- cbind(temp[[3]][, 1], temp[[3]][, 2])
str(temp2)
Hope this helps,
Rui Barradas
Citando Jun Shen :
> Dear list,
>
> Say I have some quantile operation like this
>
> data.frame(ID=rep(1:10,each=10),CONC=runif(100)) -> test
>
> lapply(c('mean
Hello,
Please respond to the list, not just to me.
If you just want the first vector ofm the matrices, try the following.
fun <- function(..., n, replace = FALSE){
m <- do.call(rbind, list(...))
idx <- sample(nrow(m), n, replace = replace)
m[idx, 1]
}
n <- 3 * nrow(Young.list1) * 0.2
Hello,
What do you want to sample? Rows? With or without replacement? You
need to give us more information on what you want.
Start by seeing the help page for ?sample
Hope this helps,
Rui Barradas
Citando MARYAM :
> Dear mr/madam
> I have 3 matrix with 20 rows and 3 columns like this: I w
Hello,
Try the following.
mySD <- function(x) {sapply(x, function(y) sqrt(var(y)))}
Hope this helps,
Rui Barradas
Citando John Sorkin :
> I am trying to use the by function to get the SD of each column of
> a data frame, stratified by ARM. Using a suggestion provided by both
> William
Hello,
Try using an equal sign after 'sigma':
algo=maxNR(loglikelihood,
start=c(sigma=8.686603,beta1=-4.976215,beta2=7.313875))
Hope this helps,
Rui Barradas
Citando Emma MONTARSOLO :
> Hi !
>
> I use maxNR function (from maxLik package) to estimate parameters
> via maximum likelihood a
Hello,
Is that a real doubt? Like Bert said, you should spend some time with
an R tutorial. All you need is to know how to form a data.frame.
tmp <- tapply(tab1$S1, tab1$time, function(x) length(unique(x)))
data.frame(time = names(tmp), S1 = tmp)
Rui Barradas
Citando Ashta :
> Hi Rui ,
>
1 - 100 of 107 matches
Mail list logo