Displaying 20 results from an estimated 2000 matches similar to: "To preserve the class "Matrix""
2008 Apr 09
11
Number of words in a string
Hi R,
A quick question: How do we find the number of words in a string?
Example:
C="Have a nice day"
And the number of words should be 4. any built in function or?...
Thanks, Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com
This e-mail may contain
2008 May 13
2
Remove an object by the reference
Hi R,
A simple question, but don't know the answer...
x="a"
a=5
I need to remove the object "a" by using only x. something like rm(somefunction(x))...Is this possible?
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com
This e-mail may contain
2008 May 14
2
dataframes to a list
Hi R,
I have the data frames, data1, data2....data50. Now I want to put all of
these in a single list. But,
>list(data1, data2,.........data50) is very big to write. How do I then
do it?
Thanks,
Shubha
This e-mail may contain confidential and/or privileged i...{{dropped:13}}
2008 Aug 12
7
Between the values
Hi R,
This is a very trivial one....
C=0.1
I want to check whether my value of C is between 0 and 1 exclusively....
I don't want to use (C>0 & C<1). And I can't use a single statement like
(0<C<1). Is there a between function? Or how do we specify from 0 to 1?
Does %in% help me?
Many Thanks,
Shubha
This e-mail may contain confidential and/or
2008 Feb 06
1
wilderSum
Hi,
Can somebody tell me the formula for "?wilderSum" in TTR package? I mean how are these calculated?
BR, Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com
This e-mail may contain confidential and/or privileged i...{{dropped:13}}
2008 May 13
3
Regular Expressions
Hi R,
Again struck with regular expressions...
Suppose,
S=c("World_is_beautiful", "one_two_three_four","My_book")
I need to extract the last but one element of the strings. So, my output should look like:
Ans=c("is","three","My")
gsub() can do this...but wondering how do I give the regular expression....
2008 May 24
1
Solving 100th order equation
Hi R,
I have a 100th order equation for which I need to solve the value for x. Is there a package to do this?
For example my equation is:
(x^100 )- (2*x^99) +(10*x^50)+.............. +(6*x ) = 4000
I have only one unknown value and that is x. How do I solve for this?
BR, Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore *
2008 Nov 07
2
Mismatch in logical result?
Hi R,
I have certain checkings, which gives FALSE, but actually it is true. Why does this happen? Note that the equations that I am checking below are not even the case of recurring decimals...
> 1.4^2 == 1.96
[1] FALSE
> 1.2^3==1.728
[1] FALSE
Thanks in advance, Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo *
2008 Jun 19
2
Comparison between R and MATLAB
Hi R,
Can I get a comparison between R and MATLAB? How is R efficient than MATLAB? Or what are the weaknesses of R compared to MATLAB?
Thank you very much for your help,
Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com
This e-mail may contain confidential and/or
2008 Mar 25
3
Dimensions of a List
Hi R,
I have a list,
l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66)))
> l
[[1]]
[[1]][[1]]
[1] 1 2
[[1]][[2]]
[1] 4 5
[[1]][[3]]
[1] 6 7
[[2]]
[[2]][[1]]
[1] 11 22 33
[[2]][[2]]
[1] 44 55 66
How do I know the dimensions of this list?... In other words, how many
sub-lists, sub-sub-lists etc...are there in l? How do I know this?
2008 Sep 08
1
To find vector X under contraints
Hi R,
I have the variance-covariance matrix,
>V=matrix(c(0.011119238, 0.002407527, 0.002407527, 0.020739401),2,2)
I need to find a vector X=c(x1,x2), such that
1) X'VX is equal to a constant 2 (say) and
2) sum(x) should be equal to a another constant 1.5 (say).
How do we do this in R?
BR, Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94
2008 Aug 07
3
Downloading Yahoo data
Hi R,
I am trying to download the data from R. I give the below command.
> library(fImport)
> yahooSeries("IBM")
trying URL
'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&
g=d&x=.csv'
Error in download.file(url = url, destfile = file, method = method) :
cannot open URL
2009 Jan 24
1
Calling R from SAS
Can I call R from SAS? I tried the below command in SAS, but not
working...
OPTIONS XWAIT XSYNC;
X "C:\Program Files\R\R-2.7.1\bin\R.exe --no-save -quiet
<""C:\TEMPO\program.r""> ""C:\TEMPO\program.log""";
Had done this before and it was working perfect... But now, not...
Sorry if this query was supposed to be put in SAS mailing
2010 May 11
1
Creating R exe files
Hi all,
Just like Fortran creates EXE files for a code, can R also do the same? Thanks for the info.
Thanks and Regards,
Shubha Karanth | Amba Research
Ph +91 80 3980 8283 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com
This e-mail may contain confidential and/or privileged i...{{dropped:13}}
2010 Jan 03
2
Scores in Dimensions in Correspondence Analysis
Hi R,
I was experimenting with the CA package for correspondence analysis.
data(author)
ca(author)
plot(ca(author))
How can I get the values used by the plot for the two axis for biplot?
In other words, how will I be able to obtain the scores in the
dimensions (which are obtained by PCA) of the graphs? Thanks.
Thanks and Regards,
Shubha
This e-mail may contain
2008 Oct 13
2
SAS Data
Hello everybody,
I would like to read a SAS Data data1.sas7bdat in R! Is this possible?
Thank you a lot in advance ;),
Stefo
2008 Sep 08
3
extracting max row from data matrix
dear group,
i have a data matrix with some replicate items with different values. I want to extract the row with max value.
for example:
> x
fruit weight
1 apple 1.3
2 apple 1.5
3 apple 1.6
4 orange 1.4
5 orange 1.6
x is a data frame.
I want to extract unique items from fruits that has max weight.
that is:
3 apple 1.6
5 orange 1.6
I want to be able to use
2008 May 06
2
single plot statement, multiple plots
Hi R,
par(mfrow=c(2,2))
x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4
I need to write a single plot statement, which creates 4 plots (for x1,
x2, x3 and x4) in the graphics window, without using 'for' loop. Is this
possible? Does 'do.call' help in this context? Or do I have any option
in the 'plot' statement itself to do this?
Thanks in advance,
Shubha
This
2008 Jun 19
2
Calling R functions into C# or C++
Hi R,
I have a request...
Can I call R functions/routines from C# or C++? If so, how do I do this? Do I need to have some knowledge on DLL to do this?
Thanks a lot for your help,
Shubha
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com
This e-mail may contain
2008 Jul 08
8
Sum(Random Numbers)=100
Hi R,
I need to generate 50 random numbers (preferably poisson), such that
their sum is equal to 100. How do I do this?
Thank you,
Shubha
This e-mail may contain confidential and/or privileged i...{{dropped:13}}