S-plus question about length of data

  • Thread starter ToxicBug
  • Start date
Hello, I'm trying to figure out how to program the Exponential Integral function, and then make it compute values for a vector of data.

I have this:
Code:
expint <- function(s){ 
     integrand <- function(x) {exp(x)/x} 
     integrate(integrand, lower = -Inf, upper = s)$integral
}
if I put expint(-1) then it works, but it doesn't work if I put expint(vectorofvalues), it gives me the following error:

Warning messages:
1: Condition has 72 elements: only the first used in: e1 && e2
2: Condition has 72 elements: only the first used in: e1 || e2
Problem in bound + (sgn * (1 - nodes))/nodes: length of longer operand (72) should be a multiple of length of shorter (15)

Anyone know what I need to change for it to work with vectors?
 

Want to reply to this thread?

"S-plus question about length of data" You must log in or register to reply here.

Related Threads for: S-plus question about length of data

Replies
0
Views
5K
Replies
0
Views
4K
Replies
0
Views
2K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top