Displaying 20 results from an estimated 2000 matches similar to: "iterate over vector with "range vector" inside"
2010 Jun 08
2
how to ignore rows missing arguments of a function when creating a function?
Hi,
I am relatively new to R; when creating functions, I run into problems with
missing values. I would like my functions to ignore rows with missing values
for arguments of my function) in the analysis (as for example is the case in
STATA). Note that I don't want my function to drop rows if there are missing
arguments elsewhere in a row, ie for variables that are not arguments of my
2013 Feb 14
2
Plotting survival curves after multiple imputation
I am working with some survival data with missing values.
I am using the mice package to do multiple imputation.
I have found code in this thread which handles pooling of the MI results:
https://stat.ethz.ch/pipermail/r-help/2007-May/132180.html
Now I would like to plot a survival curve using the pooled results.
Here is a reproducible example:
require(survival)
require(mice)
set.seed(2)
dt
2012 Jul 25
2
reshape -> reshape 2: function cast changed?
Hi,
I used to use reshape and moved to reshape2 (R 2.15.1). Now I tried some of my older scripts and was surprised that my cast function wasn't working like before.
What I did/want to do:
1) Melt a dataframe based on a vector specifying column names as measure.vars. Thats working so far:
dfm <- melt(df, measure.vars=n, variable_name = "species", na.rm = FALSE)
2) Recast the
2011 Oct 23
0
code review: is it too much to ask?
Hello all,
I really appreciate how helpful the people in this list are. Would it be too much to ask to send a small script to have it peer-reviewed? to make sure I am not making blatant mistakes? The script takes an experiment.dat as input and generates system Throughput using ggplot2. It works now ... [sigh] but I have this nasty feeling that I might be doing something wrong :). Changing
2004 Feb 09
2
apply on logical data frame together with all (PR#6560)
Full_Name: Roland Puntaier
Version: 1.8.1
OS: Windows XP
Submission from: (NULL) (62.99.238.78)
I have a data frame with some columns being logical.
I wanted to calculate a column that is an AND combination of the other logical
columns.
I tried to use
apply(df,1,all)
It did not work because of the implicit string conversion.
So I made the functions
All<-function(...)
2007 May 17
1
MICE for Cox model
R-helpers:
I have a dataset that has 168 subjects and 12 variables. Some of the
variables have missing data and I want to use the multiple imputation
capabilities of the "mice" package to address the missing data. Given
that mice only supports linear models and generalized linear models (via
the lm.mids and glm.mids functions) and that I need to fit Cox models, I
followed the previous
2009 Apr 22
1
How do I loop through strings?
I read in a CSV file with Data <-
read.csv(file="FileName.csv",head=TRUE,sep=",")
the file containts strings in the 2nd and 3rd columns and each has about
1000 rows. I need to either loop through the strings there looking for
strings that would trigger other logic or remove those rows and put them in
another array and loop through them in the new array. I can't seem
2009 Dec 07
2
data.frame to "stacked frame"
Hi,
have anybody a hint how i could avoid the cumbersome way (..especially
the value part)
change the data representation from n column data.frame to an stacked
representation.
many thanks
Christian
#example data
dfw <- as.data.frame(matrix(runif(10*10),ncol=10))
dfw$group <- sample(c("X","Z"),nrow(dfw),replace=T,prob=c(0.75,0.25))
# change
var <-
2010 Jan 18
2
ggplot2 histogramm
Hi,
i get no success change the title of the "fill" (colour) legend and the
defintion of "levels". Have anybody a hint how i can do this.
df <-
data.frame(variable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500))
p <- ggplot(df, aes(x = variable))
p + geom_histogram(aes(y= ..count.. /
2010 Jul 12
0
Error in storage.mode(test) <- "logical"
Hi There,
I get the following error from the code pasted below: Error in storage.mode(test) <- "logical" :
object 'HGBmt12_Natl_Ave_or_Facility' not found
library(RODBC)
library(car)
setwd("c://temp//cms")
a07.connect <- odbcConnectAccess2007("DFC.accdb")
sqlTables(a07.connect) ##provides list of tables##
dataset <-
2012 Jan 24
2
reshape dataframe to array (pivot table)
Hello,
I would like to reshape a dataframe into an array. This is kind a similar task as Excel performs with a Pivot table. To illustrate it:
LOC <- factor(c(1,2,2,3,1,1))
SPEC1 <- c(0,0,23,0,12,11)
SPEC2 <- c(1,2,0,0,0,4)
df <- data.frame(LOC,SPEC1,SPEC2) # original dataframe
a <-
2005 Apr 07
1
Bug#303661: logcheck-database: openntpd rules
Package: logcheck-database
Version: 1.2.37
Severity: normal
Hello again,
openntpd gives messages like these failry often:
Apr 7 14:25:55 terminus ntpd[673]: peer 204.17.42.202 now invalid
Apr 7 14:26:10 terminus ntpd[673]: peer 204.17.42.202 now valid
I am not sure if this is something that an admin may find relevant but they happen fairly often and they do not offer a lot of info
for me.
2005 Apr 02
3
Bug#302744: logcheck-database: postfix rules
Package: logcheck-database
Version: 1.2.36
Severity: wishlist
Hello,
I recently blew away my old logcheck-databse and lost a number of changes that i had made to postfix entries. The default database for postfix reports the
following errors that do not seem to be important...
Apr 2 13:00:19 terminus postfix/local[29516]: 574B9B3B9F: to=<doug at localhost>, relay=local, delay=13,
2005 Apr 08
0
Using Flexible Discriminant Analysis (fda) in mda
Greetings everyone,
I was wondering if anyone had experience in using fda (flexible discriminant analysis) in the mda package. Specifically, I can run the model but I cant locate/produce much of anything beyond the predicted values and confusion matrix. I've been searching for more examples or documentation but cant seem to locate any specific to the program itself.
I need to be able to find
2006 Mar 29
9
Ftp upload shaping 2 ISP\'s problems....
I would lilke to shape upload ftp bandwidth in a dual ISP setup
[shorewall show connections]
tcp 6 431215 ESTABLISHED src=192.168.2.89 dst=83.xxx.xxx.23 sport=1487 dport=21 src=83.xxx.xxx.23 dst=10.0.11.2 sport=21 dport=1487 [ASSURED] use=2 mark=1
[tcdevices]
#INTERFACE IN-BANDWITH OUT-BANDWIDTH
$EIF 970kbit 245kbit
$LIF 970kbit 245kbit
2004 Feb 09
0
apply on logical data frame together with all (PR#6560 )
Wrap your data frame in data.matrix() and you should be fine; e.g.,
apply(data.matrix(df), 1, all)
Don't think this qualifies as bug...
Andy
> From: roland.puntaier@chello.at
>
> Full_Name: Roland Puntaier
> Version: 1.8.1
> OS: Windows XP
> Submission from: (NULL) (62.99.238.78)
>
>
> I have a data frame with some columns being logical.
> I wanted to
2004 Feb 09
0
apply on logical data frame together with all (PR#6560
Wrap your data frame in data.matrix() and you should be fine; e.g.,
apply(data.matrix(df), 1, all)
Don't think this qualifies as bug...
Andy
> From: roland.puntaier@chello.at
>
> Full_Name: Roland Puntaier
> Version: 1.8.1
> OS: Windows XP
> Submission from: (NULL) (62.99.238.78)
>
>
> I have a data frame with some columns being logical.
> I wanted to
2007 Jul 10
2
Plot SpatialLinesDataFrame with xlim & ylim
I'm running windows xp, R 2.3.1 with maptools 0.6-6, I guess.
When plotting from a large SpatialLinesDataFrame and using xlim & ylim to reduce the area, the plot axes automatically have the same scale size, even if xlim and ylim ranges differ.
E.g.:
tmp <- readShapeLines(filepath)
plot(tmp,xlim=c(-126,-119),ylim=c(50,51))
The y-axis range is actually 47-54, same range as the x-axis.
2004 Dec 12
2
errors when trying to rename data frame columns
Dear R users,
I need to rename the columns of a series of data frames. The names of
the data frames and those of the columns need to be pulled from some
vectors. I tried a couple of things but only got errors. What am I
missing?
#---create data frame
dframes <- c("a","b","c")
assign(dframes[2],data.frame(11:20,21:30))
#---rename the columns
cols <-
2003 Apr 15
2
troubles with displaying legend on the plot
Dear colleagues,
I have troubles while trying to display legend on the plot.
I have data.frame fr
> fr
year M1 M2
1 1979 58.85198 56.77303
2 1980 57.59725 55.93749
3 1981 57.32133 55.55232
4 1982 54.69320 53.10566
5 1983 56.58973 55.03811
6 1984 58.81363 56.97641
7 1985 58.35583 56.82091
8 1986 60.41842 58.45457
9 1987