Displaying 20 results from an estimated 20000 matches similar to: "cat function within a loop"
2004 Sep 16
1
barplot with vcd library
'barplot' doesn't seem to work with vcd library.
Am I supposed to detach vcd when I want to use barplot?
Here's an example.
Say I have the following matrix,
> m <- matrix(c(1,2,3, 4,5,6, 3,4,5, 2,3,4), ncol=4)
> m
[,1] [,2] [,3] [,4]
[1,] 1 4 3 2
[2,] 2 5 4 3
[3,] 3 6 5 4
Then
> barplot(m)
gives a barplot of the data.
However,
2003 Feb 25
3
cat in windows vs linux
Hi all,
Easy question for you (which I failed to find the answer to in the FAQ etc). I've recently been forced to switch from linux to windows (currently windows NT), and my usual habit of putting lots of "cat" statements in slow functions to get an idea of the progress rate is no longer useful. Why -- because R waits until the function is completely finished before printing the cat
2004 Apr 16
7
Turning windows screen buffering on and off
All,
Does anyone know if there is an option I can set to turn screen-buffered
output on and off with the win32 rgui? (Apart from the point and click
method).
I am running some simulations where it is useful to watch output but it
gets mildly tiresome having to manually switch things on and off via the
gui.
Thanks
Toby.
> version
_
platform i386-pc-mingw32
arch
2005 Jan 28
2
print() from within a function - Windows specific? (PR#7584)
Full_Name: Markus Liedgens
Version: Ever since 1.6
OS: Windows 98 / Windows Xp
Submission from: (NULL) (81.63.111.226)
To control the progress of a function one can consider to use print() to issue a
message in the command window. However, using Win98 / R 1.9 or WinXP / R 2.0,
this approach is of little usefulness, since all the print() commands are issued
at once, just before the control
2005 Apr 19
1
chi-square test
a warning message appears when i use the chisq.test ,but it doesnt
appear everytime, why?
"Warning message:
Chi-squared approximation may be incorrect in:
chisq.test(matrix(c(20.1, 18.5, 2.6, 32.9, 23.5, 5.4), nc = 2)) "
why does the warning message appear, please?
Thank you very much
here is the data which I have tried appear and not appear warning
message
have warning message
2004 Oct 11
3
logistic regression
Hello,
I have a problem concerning logistic regressions. When I add a quadratic
term to my linear model, I cannot draw the line through my scatterplot
anymore, which is no problem without the quadratic term.
In this example my binary response variable is "incidence", the explanatory
variable is "sun":
> model0<-glm(incidence~1,binomial)
>
2012 Apr 04
0
Deadlines Approaching: R User Conference Registration, Hotels, Student Scholarships
DEADLINE FAST APPROACHING ? 8th Annual International R User Conference
useR! 2012, Nashville, Tennessee USA
Registration Deadlines:
Early Registration: Passed
Regular Registration: Mar 1- May 12
Late Registration: May 13 ? June 4
On-Site Registration: June 12 ? June 15
Please note: Nashville is offering several large entertainment events
the month of June, and hotels are quickly selling out.
2007 Mar 20
5
abline within data range
Dear R helpers,
I would like to have abline, for a lm model for
example, lying within data range. Do you know how to
get it?
Thank in advance
Nguyen D Nguyen
#CODE
x<- rnorm(200, 35,5)
y<- rnorm(200, 0.87,0.12)
plot(y~x, xlim=c(0,50), pch=17, bty="l")
abline(lm(y~x))
# I would like abline is between min(x) and max(x)
[[alternative HTML version deleted]]
2005 Feb 21
2
character occurence within a string
Hello,
I'm looking for a function that counts the occurences of a given character within a string.
f('|','ab|c|d') => 2
More precisely, I need to complete a vector of strings to ensure that all elements have the same count of a "separator":
a|b|c
a
|a|b|c|d
=>
a|b|c||
a||||
|a|b|c|d
I guess that scan makes use of an internal function that would do
2000 Feb 29
2
cat /etc/passwd > mksmbpasswd
Hi all,
Quick question, is it possible to take an existing /etc/passwd file and
run it through mksmbpasswd.sh (or some other script) to update a smbpasswd
file? I am asking this because everytime we change a password or add or
delete usernames on a machine, it would seem we have to do the same thing
to change th samba password file, and I'm hopeing there is an easier
way.....
thanks,
jeff
2004 Sep 20
2
Getting the real names of variables within functions
Greetings.
These days I find myself writing a lot of functions to handle routine
things. One of these is a function to create a scatterplot of
variables and draw a lowessed line so I can get some idea if there's
any relationship between them.
lowessed.plot <- function(x, y)
{ plot(x, y)
lines(lowess(x, y))
}
However, there's a slight problem: the plot axes come out labeled
2005 Oct 05
2
problem accumulating array within a function over loops
Dear R helpers,
I am having trouble with an array inside a loop.
I wish to accumulate the results of a function in an array within
the function, over several loops of a program outside the function.
The problem is that the array seems to re-set at every entry to the
function. Here is an example, so you can see what I mean.
2007 Mar 08
2
Removing duplicated rows within a matrix, with missing data as wildcards
I'd like to remove duplicated rows within a matrix, with missing data
being treated as wildcards.
For example
> x <- matrix((1:3), 5, 3)
> x[4,2] = NA
> x[3,3] = NA
> x
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
[3,] 3 2 NA
[4,] 1 NA 2
[5,] 2 1 3
I would like to obtain
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
2009 Feb 13
2
select on letter
Hi,
I was wondering if anybody can help me. In the small data set below I would like to select the index which doesn't contain the letter 'N' in the variable 'letters'. How can I discard these rows when the letter has a different position everytime (but the same letter for the whole column)?
index<-c(1,2,3)
letters<-c("CCTTGGAA", "NNTTGGAAT",
2004 Jul 27
1
Display on Windows console from script
Hello,
When I launch a script under windows it does not display sequentially
my cat calls or maybe the console is not refreshed at every line of my
script.
For instance with that code
cat("\n\n================== IMPORT DATA FROM FILE
===================\n\n")
fileschosen <- choose.files(caption="Select gpr files", filters =
matrix(c("genepix
2005 Apr 17
1
Unlogical phenomenon caused by locator
I was wondering if someone could help me!
Here is what I don't understand!
Why the text in the function isn't showing up before the locator action?
###########
plot(1:10)
toto<-function(){
cat("Why this text isn't showing up before the point selection !!!!!!!!")
point<-locator(2)
return(point)
}
toto()
P.S.: I am using the most recent version of R for mac
Thanks
2012 Jun 20
2
Conditioned Latin Hypercube Sampling within determined distance
Hi all,
I am a begginer in R and I have been trying to use the Conditioned Latin
Hypercube to choose sample points only in areas close to roads due to the
difficult thorough access in the study area. I could use a code to create
the points throughout the area, but I need to create a code to make the R
only comes up with points close to this road. I've been using the packages
2013 Apr 09
4
quotes in cat() within function
Hello all,
Sorry if this question has been answered in the past, but I could not find
an answer.
I am trying to print quotes within a cat output. The arguments are:
file= "Data labels"
directory= "/home/mylaptop/"
The function returns:
cat("The file", file, "is located in directory", directory, sep=" ")
The output R prints is
The file Data
2007 Aug 22
1
plot in for loop with "i" indexed variables does not work
Hi there
Does anyone know, why this is not working?:
par(mfrow = c(5, 5))
for (i in 1:10){
plot(x=time, y=Var.i)
}
(x-variable is time
y-variable is Var out of matrix with columns Var.1 Var.2 Var.3 etc...)
even
for (i in 1:10){
plot(x=time, y=paste("Var", i, sep=".")
}
does not work
Thanks
marc
2006 Jul 04
5
removing for loop
Dear Rusers,
Trying to reduce my for loops addiction,
could somebody tell me if there are ways to simplify
(and perhaps accelerate ?) the following line
for (i in 1:N) for (j in 1:N) m[i,j] = b[i]-b[j];
(where m is a NxN matrix and b a vector of length N)
Thanks for any hint.