Displaying 20 results from an estimated 500 matches similar to: "flexible alternative to subsetting dataframe inside nested loops"
2006 Jul 23
1
Iterated Data Input/Output with Random Forests
Hi,
I am currently writing code to input a few thousand files, run them through the
Random Forests package, and then output corresponding results.
When I use the code below:
zz<-textConnection("ex.lm.out", "w")
sink(zz)
2009 Apr 28
1
Problem with Random Forest predict
I am trying to run a partialPlot with Random Forest (as I have done many times before).
First I run my forest... Cell is a 6 level factor that is the dependent variable - all other variables are predictors, most of these are factors as well.
predCell<-randomForest(x=tempdata[-match("Cell",names(tempdata))],y=tempdata$Cell,importance=T)
Then I try my partial plot to look at the
2006 Jun 03
1
warnings messages from R when returning nothing
Hi : I have old Splus code that I am trying to turn into R
( I am using windows Xp and R 2.20 ) and I am getting a warning
from one of my statements because the behavior of R is different from Splus.
below, tempdata is a matrix of numbers and
I have the following command which basically runs through the columns and returns the minimum index of the column
where an NA occurs.
2006 Jul 05
2
apologes if you already saw this :efficiency question
hi everyone : i'm not sure if my previous mail about
this got sent. i was typing and
erroneosuyl hit a button and lost what i was typing.
anyway, i have the code below ( it works ) in which i run through the rows of a dataframe, taking out the first two
fields which are characters strings ( with some extra spacing so
i yuse gsub) and appending these character strings to a list so that i can
2012 Jul 22
2
Frame Column to List (conversion)
Hi,
Input Format: excel file (XLS)
Column 1: Gene ID (alphanumeric)
Column 2 - 10 : (numeric data).
inData = read.xls ( <fileName>)
geneLabel = inData [ , 1] - column 1 stored in geneLabel
tempData = inData [ , 2: 10]
expValues = data.matrix (tempData) - convert frame into Matrix format
expValues has the matrix format needed for analysis.
I need to bind gene labels as .
I
2008 Feb 25
1
Problems with augPlot and for loops
Dear all,
I'm a new R user and I find myself in trouble with some of the plot
functions.
I'm trying to save a sequence of plots to eps files using a for loop, but I
get only empty figures.
In each iteration of the for loop I fit a nlme model and I'd like to plot
its prediction of the dependent variable values.
This is the code I'm using to plot the figures (I removed the commands I
2010 Apr 12
1
N'th of month working day problem
Dear Gabor,
Thanks for your reply. however:
> tail(DJd)
^DJI.Close
2010-04-01 10927.07
2010-04-05 10973.55
2010-04-06 10969.99
2010-04-07 10897.52
2010-04-08 10927.07
*2010-04-09 10997.35*
> tail(ag)
2009-11-30 10344.84
2009-12-31 10428.05
2010-01-31 10067.33
2010-02-28 10325.26
2010-03-31 10856.63
*2010-04-30 10997.35
*
It seems the script "makes up"
2012 Mar 30
3
Adding text for written comments to bottom of graphs
Hello All,
Recently developed the code below for graphing patterns of chemotherapy administration. As someone just starting to use R in their work, I managed to figure out some parts of the code but needed help with others.
setwd("N:/Regimen Coding/0906/Plots Test")
getwd()
TestData <- structure(list(profile_key = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3), line = c(1, 1,
2012 Dec 20
2
Filling Lists or Arrays of variable dimensions
Following problem:
Say you have a bunch of parameters and want to produce results for all combinations of those:
height<-c("high","low")
width<-c("slim","wide")
then what i used to do was something like this:
l<-list()
for(h in height){
l[[h]]<-list()
for(w in width){
l[[h]][[w]] <- doSomething()
}
}
Now those parameters aren't
2004 Dec 12
1
Re: [R-sig-finance] dates and times on Windows for fMetrics
# Here is the solution:
require(fBasics)
# Be sure that R is running in time zone GMT.
# Set your Windows environment variable to "GMT"
# Your PC Windows clock can still run in any other time zone!
# My clock is now running in Zurich in Europe.
Date = c("2003-10-09", "2003-10-10", "2003-10-13", "2003-10-14")
Open = c(1.27, 1.25, 1.27,
2018 Jan 31
0
MICE data analysis with glmulti
Dear All,
wonder if you have some thoughts on running the with() function (and perhaps including the pool() function to get the results?) in glmulti? In other words, how to run glmulti with a data set that is produced by mice()?
publicly available code:
data <- airquality
data[4:10,3] <- rep(NA,7)
data[1:5,4] <- NA
data <- data[-c(5,6)]
library(mice)
library(glmulti)
the following
2011 Aug 03
4
Convert matrix to numeric
I have a matrix that looks like this:
structure(c("0.0376673981759913", "0.111066500741386", "1", "1103",
"18", "OPEN", "DEPR", "0.0404073656092023", "0.115186044704599",
"1", "719", "18", "OPEN", "DEPR", "0.0665342096693433",
2007 Oct 10
0
encode return 0
Hi.
I?m trying to use the speex library in c#, everything seems to works right,
when I call the speex_encode_int function it always return 0, any help would
be appreciated.
Here?s the sequence of calls:
//Initialization
_Mode = speex_lib_get_mode(0);
_State = speex_encoder_init(_Mode);
fixed (int* __FrameSize = &_FrameSize, __Complexity =
2007 May 31
0
loading several "samples" of data from hard-drive, run "lm", "rlm", etc, save results in a list
I have many "sample" datasets (e.g. sample 5, sample 6, etc), each identified by a number as a suffix. These datasets are saved as individual R objects on my hard drive. (e.g."Wind.5.r" . "Wind.6.r","Solar.5.r","Solar.6.r") For example purposes, I have written code that creates similar data files using the "airquality" dataset. (see
2010 Feb 02
0
Plot questions: grid line do not correspond to tick marks and 2 line axis label
Hello list,
Thank you very much for replying to my earlier questions. I have a few new
questions about R plots:
Example: tempdata:
RDate Price
2009-12-09 12:00 100
2009-12-09 15:00 99
2009-12-09 18:00 102
....
2009-12-10 8:00 120
2009-12-10 10:00 110
2009-12-10 16:00 105
My code: (RDate already in R date-time class)
plot (price~RDate, data=tempdata, "l")
axis.POSIXct(1,
2013 Sep 09
1
regression imputation in R
i have a data matrix with some x variables complete and some y variables
incomplete. i want to use the simplest regression imputation to fill in the
missing data. (form a regression line with all complete cases and predict
the missing values). is there any package that can do so? if not how should
i write the code?
--
View this message in context:
2010 Apr 03
2
histogram-like barplot? (or reverse?)
Hi,
I have a simple task I can't figure out. I'd like to take
some measurements I made, e.g.:
year (y-axis)
1
2
3
4
5
6
counts (x-axis)
10
10
20
30
40
50
And then, make a barplot with the x-axis ticks (representing
the borders between years) between the bars.
However, barplot seems to force you to make the x-axis
arbitrary categories. I want it to be continuous (as in a
2013 Mar 07
5
multiple plots and looping assistance requested (revised codes)
Hi Irucka,
I tried it and was able to plot it without any errors.? Here, your code indicates you need two lines. temper[[i]][1]
?temper[[1]][1] # which is the column 1.
? Month
1???? 1
2???? 2
3???? 3
?temper[[1]][2]
#? Data1
#1?? 1.5
#2? 12.3
#3? 11.4
Suppose I use names(temper) instead of seq_along(temper)
pdf("irucka.pdf")
?lapply(names(temper),function(i)
2003 Sep 19
2
extracting the levels of a subset of data
Hi,
> tmpdata<-subset(myd, TYPE=="A")
> levels(tmpdata$TYPE)
> [1] "A" "B" "C"
I'd like to get only "A" as output...
Thanks for your help
Marc
2007 Sep 28
2
plot graph with error bars trouble
Hi,
I have a data set like this:
Mutant Rep Time OD
02H02 1 0 0.029
02H02 2 0 0.029
02H02 3 0 0.023
02H02 1 8 0.655
02H02 2 8 0.615
02H02 3 8 0.557
02H02 1 12 1.776
02H02 2 12 1.859
02H02 3 12 1.668
02H02 1 16 3.379
02H02 2 16 3.726
02H02 3 16 3.367
306 1 0 0.033
306 2