Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204922

Need help adding column with associated characters

$
0
0

Table before adding associated cost vector

I am trying to add a new column that has an associated cost depending on the item code listed in the first column.

Here is the price sheet:

| Item | Price |

|:-----|:-----:|

| "ABXF" | 5.99 |

| "QZUY" | 7.99 |

| "PWSX" | 8.99 |

| "HBNC" | 10.99 |

| "ZPLD" | 14.99 |

when trying to add the new column I keep getting a repeating error "the condition has length >1 and only the first element will be used". this results in each row having an associated price of 14.99. I'm not sure how to fix this. here is the code I wrote and the output

attempted code chunk


Viewing all articles
Browse latest Browse all 204922

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>