Displaying 20 results from an estimated 21 matches for "tempdata".
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)
tempData<-read.delim(paste("allSnps",1,"Phenotype.phn",sep=""),header=TRUE,sep=",",quote="\"",dec=".")
tempData[[1]]<-factor(tempData[[1]])
tempData.rf<-randomForest(tempData[[1]]~.,data=tempData,importance=TRUE,proximity=TRUE,outscal...
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 effect of a specific predictor.
partialPlot(x=predCell,pred.data=tempdata[-match("Cell",names(tempdata))],x.var="P7_6")
I get this error:
Error in predict.random...
2010 Mar 24
1
flexible alternative to subsetting dataframe inside nested loops
I have a dataFrame variable:
L1 L2 L3 ... v1 v2 ...
1
2
3
4
...
I want to process subsets of it as defined by combinations of L1-L2-L3. I do
it successfully using nested loops:
for (i in valuesOfL1 {
for (j in valuesOfL2) {
for (k in valuesOfL3) {
tempData <- subset(dataFrame, (L1 == i & L2 == j & L3 == k,
select=c(v1,v2) ))
if (dim(tempData)[1]>0) # does this combination of L1-L2-L3 contain
any data?
{ process(tempData) }
}
}
}
It works fine but:
1. I'm sure there can be more efficient solution
2. each time...
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.
badindices<-sapply(tempdata,function(x)min(bdind<-seq(along=x)[is.na(x)])))
The problems seems to be that, if the column doesn...
2006 Jul 05
2
apologes if you already saw this :efficiency question
...ere might be a ( even just slightly. it doesn't have to be incresible improvement ) more efficient way to do this. I also think that remember someone saying that using the c command to make something bigger is not a good idea.
the code is below. thanks.
for paircounter in 1:nrow(tempdata) {
firsstock<-gsub(" ","",tempdata[paircounter,1]
secondstock<-gsub(" ","",tempdata[paircounter,2]
if ( paircounter == 1 ) {
stocklist<-c(firststock,secondstock)...
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
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 have this data in geneLablel (extracted from data.frame)
How do I convert this to a list so i can use
rownames(ex...
2004 Dec 12
1
Re: [R-sig-finance] dates and times on Windows for fMetrics
...hat I had the time and date stuff nearly under control. I
> don't get the ubiquitous "GMT" warning although I'm not sure that the
> way I have done it is correct. I use a batch file to invoke R
>
> set TZ=GMT
> rgui.exe
>
> I have a dataset that I use called tempdata
>
> > str(tempdata)
> `data.frame': 300 obs. of 7 variables:
> $ date : chr "2003/10/09" "2003/10/10" "2003/10/13" "2003/10/14"
> ...
> $ Open : num 1.27 1.25 1.27 1.29 1.27 1.28 1.32 1.35 1.35 1.34 ...
> $ High...
2018 Jan 31
0
MICE data analysis with glmulti
...?) 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 line will compute the missing data:
tempData <- mice(data,m=5,maxit=50,meth='pmm',seed=500)
and the following 2 lines will run the regression on the mice output and pool the results to establish the final result of interest for the model specified...
modelFit1 <- with(tempData,glm(Temp~ Ozone+Solar.R+Wind))
summary(pool(modelFi...
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",
2008 Feb 25
1
Problems with augPlot and for loops
....
I also tried to open and close a device in each loop iteration,
for (i in 1:length(names(DatasetSa))) {
#[...]
fignam <- paste("SaReg",i,sep=".");
fignam <- paste(fignam,".eps",sep="");
postscript(file=fignam)
tempData<-augPred(DatasetGrp.fit,primary = ~R, level = 0:1)
plot(tempData)
dev.off()
#[...]
}
in that case I get the correct number of eps files but they are all empty.
I would really appreciate you help.
Thank you,
NB
[[alternative HTML version deleted]]
2007 Oct 10
0
encode return 0
.../*SPEEX_SET_COMPLEXITY*/,
__Complexity);
speex_encoder_ctl(_State, 24 /*SPEEX_SET_SAMPLING_RATE*/,
__SamplingRate);
}
_Bits = new SpeexBits();
//Data encoding
public byte[] ProcessData(byte[] ABuffer, int ADataSize)
{
int OutputDataSize;
short[] TempData = new short[ADataSize];
for (int Index = ADataSize-1; Index >= 0; Index--)
TempData[Index] = (short)((ABuffer[Index] << 8) ^ 0x8000);
fixed (short* __TempData = &TempData[0])
{
fixed (void* __Bits = &_Bits)
{
if (s...
2007 May 31
0
loading several "samples" of data from hard-drive, run "lm", "rlm", etc, save results in a list
...uot;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 below)
#this creates my sample data files
library(datasets)
getwd() #fyi
for(m in 5:9) {
tempdata=subset(airquality,Month==m)
for (col in 1:4){
tempdata2 = tempdata[col]
tempname=paste(names(airquality)[col],m,sep=".")
assign(tempname,tempdata2,pos=.GlobalEnv )
save( list=tempname , file = paste(tempname,".r",sep="" ) )
rm(tempdata2,list=tempname,tempname)
}
rm(te...
2010 Apr 12
1
N'th of month working day problem
...gt; idx<- na.locf(seq_along(z.na) + (0 * z.na))
>>
>> # pick off elements of z.na corresponding to i'th of month
>>
>> noofday<- paste(day)
>>
>> if (day<10) noofday<-paste("0",day, sep="")
>>
>> tempdata<-z.na[idx[format(time(z.na), "%d") == noofday]]
>>
>> return(tempdata)
>>
>> }
>>
>> length(chooseday(DJd,1))
>> length(chooseday(DJd,2))
>> length(chooseday(DJd,31))
>> length(chooseday(DJd,30))
>> length(chooseday(DJ...
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, at=seq(min(data$RDate), max(data$RDate)+60, b...
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:
2012 Mar 30
3
Adding text for written comments to bottom of graphs
...ug", "stop_drug"))
TestData$drug <- factor(TestData$drug, levels = c("Drug D", "Drug C", "Drug B", "Drug A"))
TestData$key_line <- with(TestData,paste(profile_key, line, sep = ""))
TestData
require(ggplot2)
temp <- TestData
TempData <- split(TestData, TestData$key_line)
for(temp in TempData){
png(filename = paste("plot", unique(temp$key_line), ".png", sep = ""), width=600, height=300)
p <- ggplot(temp, aes(value, drug, fill = factor(instance))) + geom_line(size = 6) + xlab("\n Time (...
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