Displaying 20 results from an estimated 300 matches similar to: "nested 'while' loops"
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 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 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
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
2009 Mar 30
3
Calculating First Occurance by a factor
I'm having difficulty finding a solution to my problem that without using a
for loop. For the amount of data I (will) have, the for loop will probably
be too slow. I tried searching around before posting and couldn't find
anything, hopefully it's not embarrassingly easy.
Consider the data.frame, Data, below
Data
Sub Tr IA FixInx FixTime
p1 t1 1 1 200
p1 t1 2
2010 Sep 10
4
for loop help please!
Hi Everyone,
I have a 2-dim data.matrix(e.g., table1) in which row1 specifies a range of
values. row2 - rown specify the number of times I want to replicate each
corresponding value in row1. I can do this with the following function:
rep(c(table1[1,]),c(table1[X,])) #where X would go from 2 - n.
Now, I can do this manually by changing the values of X and save each
resulting array/vector in
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
2006 Oct 24
0
plot(all.effects)
Dear r-helpers,
plot(all.effects()) uses trellis for its output, and often produces
several effect plots in a layout. Can anyone tell me how to set the
arguments to plot.effect which default to
row=1, col=1, nrow=1, ncol=1, more=FALSE
so that I can plot multiple effect plots on one layout?
I was hoping that a call like
last <- rep(c(TRUE, FALSE), c(3, 1))
lay <-matrix(c(1:4,), 2, 2,
2008 Sep 18
4
Strange ! characters inserted into emails
I have never encountered anything like this before, so thought I'd post here
and see if anyone can help.
We have a java application that sends out notification emails to end-users.
The body of the email is some boilerplate text and HTML that is pulled from
a database. When the emails are received there are random instances of " !"
(that's a space and a bang symbol) inserted
2011 Apr 07
1
transform() on selective names. Is it possible?
Hi all,
I am whitening my data:
# code begins
N <- 300
M <- 2
x <- matrix(data=rnorm(N*M, 0, 3)-10, ncol=M, nrow=N)
y <- matrix(c(1,-2,-2,1), ncol=M, nrow=M)
z <- data.frame(x %*% y)
colnames(z) <- c('x','y')
par(mfrow=c(1,3))
plot(z, pch=5, col="blue")
whiten <- function(x) { (x-mean(x))/sd(x) }
zz <- transform(z, x=whiten(x), y=whiten(y))
2023 May 02
1
Reg: Help regarding ggplot2
It's not clear what you want but ...
On 02/05/2023 10:57, Upananda Pani wrote:
> Dear All,
>
> I have a dataset which contains date and 12 other countries data. I
> have extracted the data as xts object.
>
> I am not able to recall all the series in the Y axis. My data set
> looks like this
>
> index crepub finland france germany italy netherlands norway poland
>
2013 Feb 28
4
Iteration through a list in R
Hello :)
I'm just starting out with R and would appreciate your help with a couple
of problems I am running into.
I have used Sys.glob to get a list of all filenames having a particular
file extension (in my case, *.txt)
I would now like to use this list in the following manner: I would like to
use each filename from the list and open that file into a tab separated
matrix and proceed.
How can
2007 Nov 12
1
update matrix with subset of it where only row names match
I guess this has a simple solution:
I have matrix 'mat1' which has row and column names, e.g.:
A B C
row1 0 0 0
row2 0 0 0
....
rown 0 0 0
I have a another matrix 'mat2', essentially a subset of 'mat1' where the
rownames are all in 'mat1' e.g.:
B
row3 5
row8 6
row54 7
I want to insert the values of matrix mat2 for column B (in reality it
could be some or
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]]
2006 Apr 18
2
questioin about cluster in R
Hi,All.Sorry for the group mail.
I recently met a question and I have struggled on that for a while but
failed to found the solution.
I have a distance matrix as below.
---
0 35 33 9 36
35 0 10 32 51
33 10 0 30 49
9 32 30 0 35
36 51 49 35 0
-------------------
I want to do cluster with average method.
----
rown<-c("A",
2011 May 02
2
Lasso with Categorical Variables
Hi! This is my first time posting. I've read the general rules and
guidelines, but please bear with me if I make some fatal error in
posting. Anyway, I have a continuous response and 29 predictors made
up of continuous variables and nominal and ordinal categorical
variables. I'd like to do lasso on these, but I get an error. The way
I am using "lars" doesn't allow for the
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,
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).
2009 Dec 14
1
as.data.frame requires a lot of memory (PR#14140)
Full_Name: Raimar Falke
Version: R version 2.10.0 (2009-10-26)
OS: Linux 2.6.27-16-generic #1 SMP Tue Dec 1 19:26:23 UTC 2009 x86_64 GNU/Linux
Submission from: (NULL) (134.102.222.56)
The construction of a data frame in the way shown below requires
much more memory than expected. If we assume a cell value takes 8 bytes
the total amount of the data is 128mb. However the process takes about
2023 May 02
5
Reg: Help regarding ggplot2
Dear All,
I have a dataset which contains date and 12 other countries data. I
have extracted the data as xts object.
I am not able to recall all the series in the Y axis. My data set
looks like this
index crepub finland france germany italy netherlands norway poland
<date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>