Displaying 20 results from an estimated 4000 matches similar to: "Counting things"
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2008 Aug 07
6
multiple tapply
Hi folk,
I tried this and it works just perfectly
tapply(iris[,1],iris[5],mean)
but, how to obtain a single table from multiple variables?
In tapply x is an atomic object so this code doesn't work
tapply(iris[,1:4],iris[5],mean)
Thanx and great summer holidays
Gianandrea
--
View this message in context: http://www.nabble.com/multiple-tapply-tp18868063p18868063.html
Sent from the R help
2009 Aug 05
1
binning results
Hello,
I asked this as part of a previous message, but never really figured out
a usable solution. So this is a second attempt.
I have an process containing an SVM. The end result is the probability
that the class is true. That result is added back to the original data.
So I wind up with a data.frame that looks like this
label,v1,v2,v3,prob_true
What I want to do is measure how accurate
2010 Nov 03
2
bugs and misfeatures in polr(MASS).... fixed!
In polr.R the (several) functions gmin and fmin contain the code
> theta <- beta[pc + 1L:q]
> gamm <- c(-100, cumsum(c(theta[1L], exp(theta[-1L]))), 100)
That's bad. There's no reason to suppose beta[pc+1L] is larger than
-100 or that the cumulative sum is smaller than 100. For practical
datasets those assumptions are frequently violated, causing the
2020 Feb 19
2
How to index the occasions in a vector repeatedly under condition 1? if not, it will give a new index.
Dear all,
Could you please help me how to get the output as I described in the following example?
x<-c(543, 543, 543, 543, 551 , 551 ,1128 ,1197, 1197)
diff<-x-lag(x)
diff
[1] NA 0 0 0 8 0 577 69 0
How to index the occasions in x repeatedly if the diff<15? if diff>=15, it will give a new index.
I want the output be like y.
y<-c(1,1,1,1,1,1,2,3,3)
Thank you so
2020 Feb 19
2
How to index the occasions in a vector repeatedly under condition 1? if not, it will give a new index.
Dear all,
Could you please help me how to get the output as I described in the following example?
x<-c(543, 543, 543, 543, 551 , 551 ,1128 ,1197, 1197)
diff<-x-lag(x)
diff
[1] NA 0 0 0 8 0 577 69 0
How to index the occasions in x repeatedly if the diff<15? if diff>=15, it will give a new index.
I want the output be like y.
y<-c(1,1,1,1,1,1,2,3,3)
Thank you so
2019 Aug 31
2
inconsistent handling of factor, character, and logical predictors in lm()
Dear Abby,
> On Aug 30, 2019, at 8:20 PM, Abby Spurdle <spurdle.a at gmail.com> wrote:
>
>> I think that it would be better to handle factors, character predictors, and logical predictors consistently.
>
> "logical predictors" can be regarded as categorical or continuous (i.e. 0 or 1).
> And the model matrix should be the same, either way.
I think that
2019 Aug 30
3
inconsistent handling of factor, character, and logical predictors in lm()
Dear R-devel list members,
I've discovered an inconsistency in how lm() and similar functions handle logical predictors as opposed to factor or character predictors. An "lm" object for a model that includes factor or character predictors includes the levels of a factor or unique values of a character predictor in the $xlevels component of the object, but not the FALSE/TRUE values
2012 Dec 10
3
splitting dataset based on variable and re-combining
I have a dataset and I wish to use two different models to predict. Both models are SVM. The reason for two different models is based
on the sex of the observation. I wish to be able to make predictions and have the results be in the same order as my original dataset. To
illustrate I will use iris:
# Take Iris and create a dataframe of just two Species, setosa and versicolor, shuffle them
2007 Feb 22
2
Is there better alternative to this loop?
Dear List,
Thanks to those who helped with my enquiry a few days ago.
I have a another question on loops, in this case I am trying to print out
the row of a data frame if the previous 3 values (daily values) in col5 are
in descending order. I have this loop which works, but ask whether this can
be done differently (without conventional loop) in R:
flag="T"
d= 3 # d represents
2007 Nov 09
3
Normalizing grouped data in a data frame
Hi
I am a newbie to R but have tried a number of ways in R to do this and
can't find a good solution. (I could do it out of R in perl or awk but
would like to know how to do this in R).
I have a large data frame 49 variables and 7000 observations however for
simplicity I can express it in the following data frame
Base, Image, LVEF, ES_Time
A, 1, 4.32, 0.89
A, 2, 4.98, 0.67
A, 3, 3.7, 0.5
2005 Dec 31
2
Q about RSQLite
Happy new year, dear listers,
I have a question about Rsqlite.
when I fetch the data out of sqlite database, there is something like '\r\n'
at the end of last column. Here is the example:
Sepal_Length Sepal_Width Petal_Length Petal_Width Species
1 5.1 3.5 1.4 0.2 setosa\r\n
2 4.9 3.0 1.4 0.2 setosa\r\n
3
2015 Jul 27
2
Error sql en función
Hola:
No consigo que la función sqldf () funcione dentro de una función. Alguien puede echarme una mano. En resumen, el problema es que cuando lo ejecuto fuera de una función no tengo ningún problema:
==========================
> # install.packages("sqldf")
> library(MASS)
> library (sqldf)
> data(Aids2, package="MASS")
> options(digits=3)
> table
2012 Mar 20
3
Agregar variables de un dataframe
Hola a todos.Quiero saber si existe una forma mas apropiada para hacer esto:tengo un dataframe de 40 variables y una de ellas es de fechas.lo que quiero es una tabla agregada por suma y como criterio de agrupación esta variable de fecha.en sql sería algo así:
select fecha, sum(v1), sum(v2)..., sum(v39)from tablagroup by fecha;
mi problema es que las vn pueden ser de dimensión cambiante, es decir,
2015 Jul 27
2
Error sql en función
Hola Carlos:
Gracias por responder!
Ayer caí en esta página al buscar el problema con google, pero no conseguir entender y implementar lo que sugiere. Sin entender nada, lo que hice fue:
========================
> library(MASS)
> library (sqldf) # Per SQL
> data(Aids2, package="MASS")
> SQL_PROVA = function (XDADES, XWHE)
+ {
+ XDADES_SQL = sqldf ("select * from
2006 May 02
1
Use predict.lm
Hi All,
I created a two variable lm() model
slm<-lm(y[1:3000,8]~y[1:3000,12]+y[1:3000,15])
I made two predictions
predict(slm,newdata=y[201:3200,])
predict(slm,newdata=y[601:3600,])
there is no error message for either of these.
the results are identical, and identical to slm$fitted as well.
if this is not the right way to apply the model coefficients to a new
set of inputs, what is
2007 Aug 01
1
new user question on dataframe comparisons and plots
I'm coming from the scipy community and have been using R on and for
the past week or so. I'm still feeling out the language structure,
but so far so good. I apologize in advance if I pose any obvious
questions, due to my current lack of diction when searching for my
issue, or recognizing it if I did see it.
Question 1, plots:
I have a data frame with 4 type factor columns, also in the
2010 Oct 05
2
R squared for lm prediction
Hi all,
I have used a hold out sample to predict a model but now I want to compute
an R squared value for the prediction. Any help is appreciated.
Best regards
--
View this message in context: http://r.789695.n4.nabble.com/R-squared-for-lm-prediction-tp2955328p2955328.html
Sent from the R help mailing list archive at Nabble.com.
2012 Aug 01
3
Neuralnet Error
I require some help in debugging this code
library(neuralnet)
ir<-read.table(file="iris_data.txt",header=TRUE,row.names=NULL)
ir1 <- data.frame(ir[1:100,2:6])
ir2 <- data.frame(ifelse(ir1$Species=="setosa",1,ifelse(ir1$Species=="versicolor",0,"")))
colnames(ir2)<-("Output")
ir3 <- data.frame(rbind(ir1[1:4],ir2))