Displaying 20 results from an estimated 7000 matches similar to: "How to define format of number"
2012 Mar 31
3
clear console
hi,
I use R - 2.15(32bit), and want to make a code to clear a console.
Actually, I used to run following code to do that but after update the
version of R from 2.14 to 2.15, it doesn't work.
cls <- function (t) {
require(RDCOMClient)
wsh <- COMCreate("Wscript.Shell")
wsh$SendKeys("\f")
invisible(wsh)
}
cls()
or
cls <-
2012 Feb 27
5
macro function
hi,
I know how to use the "for" loop function like:
for(i in 1:ncol(mat)){
mat[i]<-b[i,2]
}
but, in this case
r1<-b[1,1]
r2<-b[2,1]
r3<-b[3,1]
r4<-b[4,1]
*
*
*
r3002<-b[3002,1]
r3003<-b[3003,1]
- must make vectors
how should I make a efficient code for that?
Is there anything in R like SAS MACRO function?
Please help me.
--
View this message in context:
2012 Mar 12
2
erasing "[1]"
hi,
is there any way to erase the term "[1]"?
for example,
> a<-3+2
> a
*[1]* 5
the term [1] in front of number 5.
is there any way?
--
View this message in context: http://r.789695.n4.nabble.com/erasing-1-tp4467628p4467628.html
Sent from the R help mailing list archive at Nabble.com.
2012 Nov 03
3
to print system.time always
Hi all;
I want to print system.time whenever I execute any command.
It takes too much time to type "system.time()" function to all command.
is there any solution on it?
And,
apply(matrix,1,cumsum) command is too slow to some large matrix.
is there any function like rowCumSums ?
thank u!
--
View this message in context:
2012 Mar 16
2
how to speed up the inefficient code
hi,
i'm really in trouble to simulate some experiment.
that is, it takes too much time to process the following code.
following is short example,
-------------------------------------------------------------------------------------------------------
p<-data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10),d=rnorm(10))
test<-data.frame(a=rnorm(1),b=rnorm(1),c=rnorm(1),d=rnorm(1))
2012 Nov 22
1
rapache memory problem
Hi all;
Now I'm developing web application by using rapache in ubuntu.
My problem is that as users execute the application, the server PC cumulates
memory.
After users close or refresh the application page, the server PC memory is
still cumulated.
Now I'm renewing apache machine by manually in terminal.
Is there any way to kill memory when users refresh or close the application
page?
2012 Mar 15
2
how to hide code of any function
hi
I'm making some program and it need to be hidden.
it's not commercial purpose but it is educational,
so i do want to hide the code of function.
for example,
if i made following function:
a<-function(x){
y<-x^2
print(y)
}
i do not want someone to type "a" and take the code of the function.
is there anyone who can help me?
--
View this message in context:
2012 Mar 16
1
how to speed up the process of R
hi
I'm simulating some experiment by "for" function.
The problem is that it takes too much time.
for example,
a<-list()
for(i in 1:100000000){
a[[i]]<-i*1000
}
is there anyway to speed up the process?
I heard there is solution but i don't have idea.
Can anyone help me?
--
View this message in context:
2012 Oct 14
1
stop at error point in for-loop
hi all:
Following is simple example,
for(i in 1:10000000){
a<-function(i){
#some function that has an error
}
}
What I want to know is the way to find the error point in for-loop, What "i"
makes the error.
is there any way to solve it instead of debugging and finding an error
manually?
Thanks,
--
View this message in context:
2012 Mar 15
1
how to assign "writeLines" function
hi,
what I want to do is assigning following code to any object.
k<-paste("thank")
writeLines(strwrap(k, width = 80,indent = 7,exdent = 6))
To assign the "writeLines" code,
I try this
a<-writeLines(strwrap(k, width = 80,indent = 7,exdent = 6))
or
assign(a,writeLines(strwrap(k, width = 80,indent = 7,exdent = 6)))
but it doesn't work.
is there any way to solve
2012 Mar 22
1
how to adjust gui window size
hi, i'm trying to make gui function by "aDialog" FUN.
What i want to do is adjusting the window size.
my function is ,
aa<- aDialog(items=list(
ps=numericItem(),
number=numericItem(),
term=numericItem()
),
OK_handler=function(.) { # . is reference to dlg object
values <- .$to_R()
do.call("KOD",values)
}
)
how can i adjust the size of the window?
Thanks~
--
View
2012 Mar 24
1
how to make output more lovely
Hi, I'm trying to make output of my function easier to see and more lovely.
As u know, R output is not easy to see for beginner of study or anyone not
expert
so I want to transform the output into other form.
Output of my function is just long text with some numerical result and
table.
Is there a way to solve it?
Thanks.
--
View this message in context:
2019 Mar 21
3
prettyNum digits=0 not compatible with scientific notation
R developers,
Seems I get a bad result ("%#4.0-1e" in particular) when trying to use prettyNum digits=0 with scientific notation. I tried on both my Linux box and on an online R evaluator and saw the same problem, so it's not limited to my box at least. I see the problem in both R 3.5.3 and R 3.3.2.
options(scipen=-100)
prettyNum(1, digits=0)
[1] "%#4.0-1e"
prettyNum(2,
2019 Mar 22
2
prettyNum digits=0 not compatible with scientific notation
FWIW, it doesn't seem to be happening on Mac OS:
> format(2^30, digits=0)
[1] "1.e+09"
> prettyNum(12345.6, digits=0)
[1] "1.e+04"
A glibc misfeature?
-pd
> On 22 Mar 2019, at 10:10 , Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
> Thank you, Robert for raising this here !
>
>>>>>> Robert McGehee
2025 May 23
1
Bug in prettyNum
? Fri, 23 May 2025 11:47:33 +0000
Marttila Mikko via R-devel <r-devel at r-project.org> ?????:
> When called with a numeric vector, the `replace.zero` argument is
> disregarded.
>
> > prettyNum(0, zero.print = "- ", replace.zero = TRUE)
> [1] "-"
> Warning message:
> In .format.zeros(x, zero.print, replace = replace.zero) :
>
2025 May 23
1
Bug in prettyNum
Dear list,
I'd like to report a bug in `prettyNum()`. When called with a numeric vector, the `replace.zero` argument is disregarded.
> prettyNum(0, zero.print = "- ", replace.zero = TRUE)
[1] "-"
Warning message:
In .format.zeros(x, zero.print, replace = replace.zero) :
'zero.print' is truncated to fit into formatted zeros; consider 'replace=TRUE'
A
2025 May 26
1
Bug in prettyNum
Thank you, Marttila and Ivan,
As the original author of prettyNum() {etc ..},
I will commit such a bug fix to R-devel (and probably port it to
R 4.5.0 patched) quite soon
(but not yet today).
Best regards,
Martin Maechler
>>>>> Ivan Krylov via R-devel
>>>>> on Fri, 23 May 2025 17:14:57 +0300 writes:
> ? Fri, 23 May 2025 11:47:33 +0000
>
2025 May 27
1
Bug in prettyNum
Thanks for the contribution Mikko!
For testing future patches, you can actually do it right in the web
browser, thanks to Heather Turner's R Dev Container, see instructions here
https://contributor.r-project.org/r-dev-env/container_setup/
Best
Toby
On Mon, May 26, 2025 at 6:28?PM Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
> Thank you, Marttila and Ivan,
>
> As
2025 May 23
1
Formatting zeroes with prettyNum
You fed it two characters, "dash" and "space" and it only wanted one character so it truncated to the first character and warned you that that's what it did.
If you had your space before the dash, it would have used that as your replacement character
> prettyNum(0, zero.print = " - ", replace = TRUE)
[1] " "
Warning message:
In .format.zeros(x,
2025 May 23
1
Formatting zeroes with prettyNum
Tim,
The purpose of the `replace.zero` argument is to allow longer replacements.
See for example the behaviour with a character vector input:
> prettyNum("0", zero.print = "- ", replace.zero = TRUE)
[1] "- "
I'm pretty sure this is a bug, and have now posted the relevant details on r-devel.
A fix would be below.
Best,
Mikko
diff --git