Displaying 20 results from an estimated 1000 matches similar to: "Extract rows with non-zero elements"
2010 Dec 16
2
Compare two dataframes
Hello,
I have two dataframes DF1 and DF2 that should be identical but are not
(DF1 has some rows that aren't in DF2, and vice versa). I would like
to produce a new dataframe DF3 containing rows in DF1 that aren't in
DF2 (and similarly DF4 would contain rows in DF2 that aren't in DF1).
I have a solution for this problem (see self contained example below)
but it's awkward and
2010 Jun 15
2
Integration problem: error in invoking an outside function
Dear all,
Currently I am trying to integrate a function which depends on four
variables, two of which are given, one is given in the integrate function,
so there is one variable to integrate on.
The code is as follows:
Pmatrix =
function(th) {
P = matrix(nrow=6, ncol=6, data=0)
P[1,1] = P[2,1]=P[3,2]=P[4,3]=P[5,4]=P[6,5]= exp(-th)
P[,6] = 1-exp(-th)
return(P)}
lim.verd =
2010 May 17
4
Adding a row at top of dataframe
I have a large data frame 48:2185 with different numbers.
I would like to add only one row at the very top of my data frame with
0's or NA's.
I don't know which approach to use. Should i create 2 different data
frames and merge them? Ive also tried the rbind command with no luck.
I would appreciate some help to achieve what I'm trying to create.
Thanks!
2023 Dec 18
3
Function with large nested list
Hello list,
I want to make a large rulebased algorithm, to provide decision support for drug prescriptions. I have defined the algorithm in a function, with a for loop and many if statements. The structure should be as follows:
1. Iterate over a list of drug names. For each drug:
2. Get some drug related data (external dataset). Row of a dataframe.
3. Check if adaptions should be made to
2007 Mar 19
1
Problem with regional settings
I'm running a Windows program with Wine under Linux (Red Hat), but I'm
having problems with the thousand and decimal separators. The Linux OS
is set to en_US.
When I tab through an inputfield with a decimal value e.g. 1,00 it'll
change to 100,00. This is really tricky, because values are changed to
complete different values.
I've been trying to change the regional settings by
2009 Mar 07
3
Question on Variables
Hi everyone,
Im quite new to R an I have the following Question:
I would like to define Variables which I can add and multiply etc. and that
R can simplyfy the terms.
The variables should stand for integers.
For example I would like to have an entry in an array with variable z
and if I add b+z the field should now contain 2z+b. Or if the field
contains 1 and I add z
2011 Aug 09
1
"Denormalize" data
Hello R users,
My problem is that the data I've got is in the minimum number of columns
with each ward (geographic area) appearing multiple times. The first 30
terms look like this
> HHum02
CASW Btype Yr CO2Group NumVeh
170597 00CCFA CARS 2002 C 2
170598 00CCFA CARS 2002 D 2
170599 00CCFA CARS 2002 E 22
170600 00CCFA CARS 2002
2016 Aug 28
2
Problemas para delimitar chunks con la fucnción spin en el paquete knitr
Estimados miembros de la lista,
Estoy trabajando con la función spin del paquete knitr y no puedo entender
por que a pesar de usar #+ para iniciar cada chunk no reconoce el inicio de
un nuevo chunk al menos que incluya texto entre cada inicio de chunk. En
el ejemplo abajo
#+
data(cars)
#+
cars
No los separa como 2 chunks diferentes
Ejemplo de mi archivo en r (prueba.R)
2016 Aug 29
2
Problemas para delimitar chunks con la fucnción spin en el paquete knitr
Muchas gracias Carlos.
Tengo la versión de knitr 1.14
Corrí el ejemplo que me dices y resulta en lo mismo, no se crean chunks
diferentes. Parece que para separar chunks se debe incluir #'
Por ejemplo, estas 2 líneas de códigos del ejemplo:
#+ test-chisq5
sum(x^2) # chi-square distribution with df 5
#+ test-chisq4
sum((x - mean(x))^2) # df is 4 now
Dan como resultado en el Rmd (todo queda
2006 Jan 13
6
Locating Objects by associated object.properties
I am just getting the hang of this, so forgive me if this is a stupid
question...
- I have two models/tables: Owners and Cars
- Owners may have many cars. Cars have one owner.
- Cars have a property named Color.
Question: how do I get a list of all the Owners who have RED cars?
I want something like this to work:
Owner.find_by_car.color("RED")
Thanks for any help!
--
Posted via
Which is the easiest (most elegant) way to force "aov" to treat numerical variables as categorical ?
2010 Jun 14
2
Which is the easiest (most elegant) way to force "aov" to treat numerical variables as categorical ?
Hi R help,
Hi R help,
Which is the easiest (most elegant) way to force "aov" to treat numerical variables as categorical ?
Sincerely, Andrea Bernasconi DG
PROBLEM EXAMPLE
I consider the latin squares example described at page 157 of the book:
Statistics for Experimenters: Design, Innovation, and Discovery by George E. P. Box, J. Stuart Hunter, William G. Hunter.
This example use
2010 Apr 02
4
Derivative of a smooth function
Dear All,
I've been?searching for?appropriate codes to compute the rate of change and the curvature?of ?nonparametric regression model whish was denoted by a smooth function?but?unfortunately?don't manage to?do?it. I presume that such characteristics from a smooth curve can be determined by the first and second derivative operators.
The following are the example of fitting a
2005 Jul 01
4
R integration with Microsoft Powerpoint
Please allow me an unusual question.
Is there any way that R can be closely integrated with a Microsoft
Powerpoint presentation? I would like to embed R calculations in
Powerpoint so that I will start Powerpoint, be prompted to enter some
parameters, and an R function will run and return values and graphs.
Thanks,
John
R 2.1.1
windows 2k
John Sorkin M.D., Ph.D.
Chief, Biostatistics and
2016 Aug 30
2
Problemas para delimitar chunks con la fucnción spin en el paquete knitr
Muchas gracias Carlos.
Tengo las mismas versiones pero no logro separar los chunks cuando uso #+,
pero si lo logro cuando uso #". Mi script es spin("prueba.R", knit =
FALSE) y si me hace un Rmd.
#+
a = c(1,2,3)
#+
mean(a)
Ejecuto,
> spin("prueba.R", knit = FALSE)
y obtengo un prueba.Rmd
```{r }
a = c(1,2,3)
```{r }
mean(a)
```
Pero si escribo:
#'
a =
2006 Jun 14
2
positioning of separate y-axis labels in xyplot
I like the functionality provided by outer=TRUE, but when it comes time
to place separate xlabs or ylabs, I always end up 'eyeballing' it on a
case-by-case basis. For example,
##begin example
require(lattice)
cars.lo <- loess(dist ~ speed, cars)
print(xyplot(cars.lo$residuals+cars.lo$fitted~cars.lo$x,
strip=FALSE,
outer=TRUE,
layout=c(1,2),
2008 Feb 03
3
Drawing a loess line
Dear all,
To draw a lowess line on a plot was a piece of cake; to draw a loess
line, however, seems not that easy. Is the loess plotting implemented
at all in relation to the loess function, or do I have to look in
add-on packages?
Thanks,
Marcin
2009 Jul 05
2
integrar resultado de splines cubicos
hola soy nuevo usuario de R y necesito crear un objeto p tal que,
p=lambda*integral[f´´(x)^2 dx ]
donde "lambda" es uno de los parametros que resultan de la funcion
"smooth.spline()" y la integral es sobre la derivada 2 de esa misma
funcion...
dos cuestiones:
1) como extraigo lambda de los resultados de smooth.spline() para usarlo
como objeto cuando lo requiera y
2) como
2008 Jul 22
2
ActiveRecord Associations issue
Hello all and thank you for reading this message.
I am new to RoR, and ruby too, but i am quite excited about it.
I am developing a RoR project and with active record associations in
the following
manner
# Tables (all tables have only one record)
CREATE TABLE `webcars_development`.`cars` (
`id` int(11) NOT NULL auto_increment,
`model_id` int(11) NOT NULL default ''0'',
2011 Jul 19
4
Randomness not due to seed
I am working on a reproducible computing platform for which I would like to
be able to _exactly_ reproduce an R object. However, I am experiencing
unexpected randomness in some calculations. I have a hard time finding out
exactly how it occurs. The code below illustrates the issue.
mylm1 <- lm(dist~speed, data=cars);
mylm2 <- lm(dist~speed, data=cars);
identical(mylm1, mylm2); #TRUE
2010 Nov 10
1
standardized/studentized residuals with loess
Hi all,
I'm trying to apply loess regression to my data and then use the fitted
model to get the *standardized/studentized residuals. I understood that for
linear regression (lm) there are functions to do that:*
*
*
fit1 = lm(y~x)
stdres.fit1 = rstandard(fit1)
studres.fit1 = rstudent(fit1)
I was wondering if there is an equally simple way to get
the standardized/studentized residuals for a