Displaying 20 results from an estimated 10000 matches similar to: "Iteration through a list in R"
2013 Mar 19
4
Copying rows in data frames
Hi,
I'm trying to copy the first row of one data frame to another. This is the
statement I am using :
df2[1,]<-df1[1,];
I have printed them out separately:
df1[1,] = A C D E F
But after copying:
df2[1,] = 96 29 88 122 68
Why isn't it copying? They are both data frames, and "as.character" isn't
working either.
Thanks for your input :)
[[alternative HTML version
2013 Mar 14
3
Equivalent of deal in R?
HI, I'm looking for a function that does the same as deal() in MATLAB, i,e,
for an array x[1 2 3]
[a,b,c]=x;
such that
a=1, b=2, c=3
Does R have any functions similar to this?
[[alternative HTML version deleted]]
2013 Mar 25
3
nested 'while' loops
Hi everyone,
I'm using the following code to go over every element of a data frame (row
wise). The problem I am facing is that the outer 'x' variable is not
incrementing itself, thus, only one row of values is obtained, and the
program does not proceed to the next row.
This is the code:
while(x<=coln)
{
while(y<=rown)
{
n<-as.numeric(df[[y]][x]);
2013 Mar 22
3
trouble with data frame
Hi everyone,
I am trying to use the values from every cell of the data frame in a
further calculation.
This is the code that I am using to catch every element of the data-frame.
while (a<=10)
{
while (b<=10)
{
n<-as.numeric(df[a,b)];
...;
}
}
The problem is that when I print out 'n' I get the following errors :
"NULL" (if printed without as.numeric), and
2013 Mar 26
2
NaNS Error Message
Hi,
I'm using R to do a series of calculation and I have gotten several
warnings that say "NaNS produced". Whatever I could read on line gives me
an idea that this warning is produced when the number is use is a negative
log or otherwise mathematically problematic.
I'm getting this error while using factorial() and gamma () on strictly
positive numbers (always greater than zero).
2013 Mar 07
2
Copying a dataframe
Hi, I am trying to create a data frame using the dimensions of another data
frame that I have input. This is the code I am using:
tab is the data frame that is input.
c.leng<-length(tab[,1]); r.leng<-length(tab[1,]);
opdf<-data.frame(ncol=c.leng, nrow=r.leng);
a<-1;
while(a<=c.leng)
{
opdf[[1]][a]<-tab[[1]][a];
a<-a+1;
}
This is the error message I am getting:
Error in
2013 Mar 12
2
Troubleshooting code
Hi everyone, I am having trouble understanding where I went wrong with my
code. It seems to logically be "all there" but the output says otherwise.
I know this is a bit long but I can't seem to find the errors so I would
appreciate your help :)
This is my program :
files<-Sys.glob("*.rescount.txt");length<-length(files);* #selecting all
files of a particular
2013 Mar 11
3
Test of Parallel Regression Assumption in R
Hi,
I am running an analysis with an ordinal outcome and I need to run a test
of the parallel regression assumption to determine if ordinal logistic
regression is appropriate. I cannot find a function to conduct such a test.
>From searching various message boards I have seen a few useRs ask this same
question without a definitive answer - and I came across a thread that
indicated there is no
2013 Mar 06
2
Generating unique filenames.
Hi,
I am trying to create unique filenames for my output text file. The idea is
that I would like to append a string to ".zsc.txt" so that all my files are
uniquely named but with a similar format. I have tried adding the string
variable to ".zsc.txt" while creating the output file name, i.e.
write.table function, is what I have tried using :
write.table(x,
2011 Apr 06
1
Error in match.names(clabs, names(xi))
Hi Guys,
I have this part of a program:
library(survival)
Gastric <- cbind.data.frame(Gp=c(rep(1,45),rep(0,45)), ### 2nd gp 0
time=c(1,63,105,129,182,216,250,262,301,301,342,354,356,358,
380,383, 383,388,394,408,460,489,499,523,524,535,562,569,675,676,
748,778,786,797,955,968,1000,1245,1271,1420,1551,1694,2363,2754,2950,
2010 May 20
10
Libtheora
Hi all,
I am Sahana. I am currently working on Libtheora for windows platform and
very new to it. I am getting a lot of compiling errors. Since Libtheora
depends on libogg and libvorbis i have added these as well to my workspace
in VC++ 6. I have a doubt regarding the x86 and x86_vc folders described in
the libtheora software.Since both these folders have the same set of files
which one do we
2013 Mar 18
1
Problem with write.table
Hi everyone,
I'm trying to create unique filenames and then write a data frame into
these files. This is the code I am using.
str1<-"fname"
str2<-".ext.txt";
FILENAME<-paste0(str1,str2);
write.table(df,
file=FILENAME,col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t");
Ideally, a file called fname.ext.txt should be created, containing the data
2012 May 21
1
Changing selected elements of an array
Hi!
I have a matrix defined on geographical positions (through) row and column
names. I need to change a number of elements in this matrix using the
information of a data.frame containing geographical positions and a number of
variables.
Changing the value of one specific element is easy, but changing on a number
of selected positions seems more difficult. When I use the geographical
2007 Jul 31
1
A complicated 'aggregate'
Hi,
I have a financial (zoo) time series with prices and volumes (although I can
get the coredata as a matrix). Due to the data-source some indices have
multiple observations. I want to aggregate these according to a weighted
average.
11:00:01 34 1000
11:00:01 35 500
11:00:01 35 1000
11:00:02 34 500
11:00:02 35 500
should become
11:00:01 34.6 2500
11:00:02 34.5 1000
I currently do this
2011 Jan 05
2
Problem with 2-ways ANOVA interactions
Dear All,
I have a problem in understanding how the interactions of 2 ways ANOVA work,
because I get conflicting results
from a t-test and an anova. For most of you my problem is very simple I am sure.
I need an help with an example, looking at one table I am analyzing. The table
is in attachment
and can be imported in R by means of this command:
scrd<-
2017 Oct 18
4
Error messages using nonlinear regression function (nls)
Hi all,
I am trying to use nonlinear regression (nls) to analyze some seed germination data, but am having problems with error codes.
The data that I have closely matches the germination dataset included in the drc package.
Here is the head of the data
temp species start end germinated TotSeeds TotGerminated Prop
1 10 wheat 0 1 0 20 0 0.0
2 10 wheat
2012 Jul 23
3
How to do the same thing for all levels of a column?
Dear all,
I am a R beginner, and I am looking for a way to do the same thing for all
levels of a column in a table.
Basically, I have a bunch of protein sequences composed of different amino
acid residues, and each residue is represented by an uppercase letter. I
want to calculate the ratio of different amino acid residues at each
position of the proteins. Here is an example table:
Proteins
2009 Jan 22
2
blowup portion of graph beside it
Hi,
I'd like to blow up portions of my graph and put it in boxes beside the
graph.Is there an addon to do this?
--
Rajesh.J
[[alternative HTML version deleted]]
2009 Oct 22
19
undefined method `stringify_keys!' for "":String
i have an error
undefined method `stringify_keys!'' for "":String
my view is given below
<%= form_tag :action => ''resolve_create'', :resolve => @resolve %>
<p>resolution:<br />
<%= text_area ''resolve'',''content'', :cols => 40, :rows => 12 %></p>
<%= submit_tag
2011 Jul 07
2
How do I overlay two trellis plots of lme fitted lines produced by plot.augPred?
Hello,
I want to use lme to fit two (or more) models, and then compare the fits
on each individual. I know how to write my own code to do this (for each
individual, plot the raw data, followed by lines() to plot each fitted
curve) but I would like to use plot(augPred(... as it produces a nice
trellis plot. I thought I could do this with par(new=T) but it does not
seem to work.